Commit Graph

3 Commits

Author SHA1 Message Date
Jeff Moyer 179f7a7dba io_uring/openclose: add support for IORING_OP_FIXED_FD_INSTALL
JIRA: https://issues.redhat.com/browse/RHEL-27755
Conflicts: RHEL is missing commit 4e94ddfe2aab ("file: remove
  __receive_fd()"), which changes the calling convention of receive_fd.

commit dc18b89ab113e9c6c7a529316ddf7029fb55132d
Author: Jens Axboe <axboe@kernel.dk>
Date:   Thu Dec 7 20:06:02 2023 -0700

    io_uring/openclose: add support for IORING_OP_FIXED_FD_INSTALL
    
    io_uring can currently open/close regular files or fixed/direct
    descriptors. Or you can instantiate a fixed descriptor from a regular
    one, and then close the regular descriptor. But you currently can't turn
    a purely fixed/direct descriptor into a regular file descriptor.
    
    IORING_OP_FIXED_FD_INSTALL adds support for installing a direct
    descriptor into the normal file table, just like receiving a file
    descriptor or opening a new file would do. This is all nicely abstracted
    into receive_fd(), and hence adding support for this is truly trivial.
    
    Since direct descriptors are only usable within io_uring itself, it can
    be useful to turn them into real file descriptors if they ever need to
    be accessed via normal syscalls. This can either be a transitory thing,
    or just a permanent transition for a given direct descriptor.
    
    By default, new fds are installed with O_CLOEXEC set. The application
    can disable O_CLOEXEC by setting IORING_FIXED_FD_NO_CLOEXEC in the
    sqe->install_fd_flags member.
    
    Suggested-by: Christian Brauner <brauner@kernel.org>
    Reviewed-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2024-07-02 14:33:35 -04:00
Jeff Moyer 3f0281207a io_uring: split out fixed file installation and removal
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit f110ed8498afa6ff8e9a8c08fb26880e02117616
Author: Jens Axboe <axboe@kernel.dk>
Date:   Mon Jun 13 04:42:56 2022 -0600

    io_uring: split out fixed file installation and removal
    
    Put it with the filetable code, which is where it belongs. While doing
    so, have the helpers take a ctx rather than an io_kiocb. It doesn't make
    sense to use a request, as it's not an operation on the request itself.
    It applies to the ring itself.
    
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:06:02 -04:00
Jeff Moyer 83351dc041 io_uring: split out open/close operations
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit cd40cae29ef815de6f7e72207b677c78f43f4688
Author: Jens Axboe <axboe@kernel.dk>
Date:   Tue May 24 21:54:43 2022 -0600

    io_uring: split out open/close operations
    
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 05:21:02 -04:00