public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Thomas Bertschinger <tahbertschinger@gmail.com>
Cc: io-uring@vger.kernel.org, axboe@kernel.dk,
	linux-fsdevel@vger.kernel.org,  viro@zeniv.linux.org.uk,
	brauner@kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/6] io_uring: add support for IORING_OP_NAME_TO_HANDLE_AT
Date: Fri, 15 Aug 2025 12:40:31 +0200	[thread overview]
Message-ID: <CAOQ4uxhAOFyei+7GqR3L9WHp4SqhC7oVpwW9eDpxe1o7mDzjoQ@mail.gmail.com> (raw)
In-Reply-To: <20250814235431.995876-3-tahbertschinger@gmail.com>

On Fri, Aug 15, 2025 at 1:51 AM Thomas Bertschinger
<tahbertschinger@gmail.com> wrote:
>
> Add support for name_to_handle_at(2) to io_uring.
>
> Like openat*(), this tries to do a non-blocking lookup first and resorts
> to async lookup when that fails.
>
> This uses sqe->addr for the path, ->addr2 for the file handle which is
> filled in by the kernel, and ->addr3 for the mouint_id which is filled
> in by the kernel.
>
> Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
> ---
>  include/uapi/linux/io_uring.h |  1 +
>  io_uring/opdef.c              |  7 ++++++
>  io_uring/openclose.c          | 43 +++++++++++++++++++++++++++++++++++
>  io_uring/openclose.h          |  3 +++
>  4 files changed, 54 insertions(+)
>
> diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
> index 6957dc539d83..596bae788b48 100644
> --- a/include/uapi/linux/io_uring.h
> +++ b/include/uapi/linux/io_uring.h
> @@ -289,6 +289,7 @@ enum io_uring_op {
>         IORING_OP_READV_FIXED,
>         IORING_OP_WRITEV_FIXED,
>         IORING_OP_PIPE,
> +       IORING_OP_NAME_TO_HANDLE_AT,
>
>         /* this goes last, obviously */
>         IORING_OP_LAST,
> diff --git a/io_uring/opdef.c b/io_uring/opdef.c
> index 9568785810d9..ff2672bbd583 100644
> --- a/io_uring/opdef.c
> +++ b/io_uring/opdef.c
> @@ -574,6 +574,10 @@ const struct io_issue_def io_issue_defs[] = {
>                 .prep                   = io_pipe_prep,
>                 .issue                  = io_pipe,
>         },
> +       [IORING_OP_NAME_TO_HANDLE_AT] = {
> +               .prep                   = io_name_to_handle_at_prep,
> +               .issue                  = io_name_to_handle_at,
> +       },
>  };
>
>  const struct io_cold_def io_cold_defs[] = {
> @@ -824,6 +828,9 @@ const struct io_cold_def io_cold_defs[] = {
>         [IORING_OP_PIPE] = {
>                 .name                   = "PIPE",
>         },
> +       [IORING_OP_NAME_TO_HANDLE_AT] = {
> +               .name                   = "NAME_TO_HANDLE_AT",
> +       },
>  };
>
>  const char *io_uring_get_opcode(u8 opcode)
> diff --git a/io_uring/openclose.c b/io_uring/openclose.c
> index d70700e5cef8..f15a9307f811 100644
> --- a/io_uring/openclose.c
> +++ b/io_uring/openclose.c
> @@ -27,6 +27,15 @@ struct io_open {
>         unsigned long                   nofile;
>  };
>
> +struct io_name_to_handle {
> +       struct file                     *file;
> +       int                             dfd;
> +       int                             open_flag;

These are not open_flags, there are handle_flags
(e.g. AT_HANDLE_FID)

> +       struct file_handle __user       *ufh;
> +       char __user                     *path;
> +       void __user                     *mount_id;
> +};
> +
>  struct io_close {
>         struct file                     *file;
>         int                             fd;
> @@ -187,6 +196,40 @@ void io_open_cleanup(struct io_kiocb *req)
>                 putname(open->filename);
>  }
>
> +int io_name_to_handle_at_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
> +{
> +       struct io_name_to_handle *nh = io_kiocb_to_cmd(req, struct io_name_to_handle);
> +
> +       nh->dfd = READ_ONCE(sqe->fd);
> +       nh->open_flag = READ_ONCE(sqe->open_flags);

Please also create union member sqe->handle_flags
or name_to_handle_flags.

Thanks,
Amir.

  reply	other threads:[~2025-08-15 10:40 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14 23:54 [PATCHSET RFC 0/6] add support for name_to, open_by_handle_at(2) to io_uring Thomas Bertschinger
2025-08-14 23:54 ` [PATCH 1/6] fhandle: create helper for name_to_handle_at(2) Thomas Bertschinger
2025-08-15 10:21   ` Amir Goldstein
2025-08-15 18:17     ` Thomas Bertschinger
2025-08-14 23:54 ` [PATCH 2/6] io_uring: add support for IORING_OP_NAME_TO_HANDLE_AT Thomas Bertschinger
2025-08-15 10:40   ` Amir Goldstein [this message]
2025-08-16  7:43   ` kernel test robot
2025-08-14 23:54 ` [PATCH 3/6] fhandle: do_handle_open() should get FD with user flags Thomas Bertschinger
2025-08-15  9:17   ` Amir Goldstein
2025-08-15 13:46     ` Christian Brauner
2025-08-15 13:51       ` Amir Goldstein
2025-08-19  9:43         ` Christian Brauner
2025-08-15 13:47   ` (subset) " Christian Brauner
2025-08-14 23:54 ` [PATCH 4/6] fhandle: create __do_handle_open() helper Thomas Bertschinger
2025-08-15 10:33   ` Amir Goldstein
2025-08-14 23:54 ` [PATCH 5/6] io_uring: add __io_open_prep() helper Thomas Bertschinger
2025-08-14 23:54 ` [PATCH 6/6] io_uring: add support for IORING_OP_OPEN_BY_HANDLE_AT Thomas Bertschinger
2025-08-16 10:10   ` kernel test robot
2025-08-15  9:52 ` [PATCHSET RFC 0/6] add support for name_to, open_by_handle_at(2) to io_uring Amir Goldstein
2025-08-15 18:24   ` Thomas Bertschinger
2025-08-19 15:11 ` Jens Axboe
2025-08-20  3:01   ` Thomas Bertschinger
2025-08-20  8:34     ` Amir Goldstein
2025-08-20 15:05       ` Thomas Bertschinger
2025-08-20 19:58         ` Amir Goldstein
2025-08-21  7:47           ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOQ4uxhAOFyei+7GqR3L9WHp4SqhC7oVpwW9eDpxe1o7mDzjoQ@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tahbertschinger@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox