Commit d884b649 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: remove IORING_CLOSE_FD_AND_FILE_SLOT

This partially reverts a7c41b46

Even though IORING_CLOSE_FD_AND_FILE_SLOT might save cycles for some
users, but it tries to do two things at a time and it's not clear how to
handle errors and what to return in a single result field when one part
fails and another completes well. Kill it for now.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/837c745019b3795941eee4fcfd7de697886d645b.1655224415.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent aa165d6d
...@@ -576,7 +576,6 @@ struct io_close { ...@@ -576,7 +576,6 @@ struct io_close {
struct file *file; struct file *file;
int fd; int fd;
u32 file_slot; u32 file_slot;
u32 flags;
}; };
struct io_timeout_data { struct io_timeout_data {
...@@ -5966,18 +5965,14 @@ static int io_statx(struct io_kiocb *req, unsigned int issue_flags) ...@@ -5966,18 +5965,14 @@ static int io_statx(struct io_kiocb *req, unsigned int issue_flags)
static int io_close_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) static int io_close_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
{ {
if (sqe->off || sqe->addr || sqe->len || sqe->buf_index) if (sqe->off || sqe->addr || sqe->len || sqe->rw_flags || sqe->buf_index)
return -EINVAL; return -EINVAL;
if (req->flags & REQ_F_FIXED_FILE) if (req->flags & REQ_F_FIXED_FILE)
return -EBADF; return -EBADF;
req->close.fd = READ_ONCE(sqe->fd); req->close.fd = READ_ONCE(sqe->fd);
req->close.file_slot = READ_ONCE(sqe->file_index); req->close.file_slot = READ_ONCE(sqe->file_index);
req->close.flags = READ_ONCE(sqe->close_flags); if (req->close.file_slot && req->close.fd)
if (req->close.flags & ~IORING_CLOSE_FD_AND_FILE_SLOT)
return -EINVAL;
if (!(req->close.flags & IORING_CLOSE_FD_AND_FILE_SLOT) &&
req->close.file_slot && req->close.fd)
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -5993,8 +5988,7 @@ static int io_close(struct io_kiocb *req, unsigned int issue_flags) ...@@ -5993,8 +5988,7 @@ static int io_close(struct io_kiocb *req, unsigned int issue_flags)
if (req->close.file_slot) { if (req->close.file_slot) {
ret = io_close_fixed(req, issue_flags); ret = io_close_fixed(req, issue_flags);
if (ret || !(req->close.flags & IORING_CLOSE_FD_AND_FILE_SLOT)) goto err;
goto err;
} }
spin_lock(&files->file_lock); spin_lock(&files->file_lock);
......
...@@ -47,7 +47,6 @@ struct io_uring_sqe { ...@@ -47,7 +47,6 @@ struct io_uring_sqe {
__u32 unlink_flags; __u32 unlink_flags;
__u32 hardlink_flags; __u32 hardlink_flags;
__u32 xattr_flags; __u32 xattr_flags;
__u32 close_flags;
}; };
__u64 user_data; /* data to be passed back at completion time */ __u64 user_data; /* data to be passed back at completion time */
/* pack this to avoid bogus arm OABI complaints */ /* pack this to avoid bogus arm OABI complaints */
...@@ -259,11 +258,6 @@ enum io_uring_op { ...@@ -259,11 +258,6 @@ enum io_uring_op {
*/ */
#define IORING_ACCEPT_MULTISHOT (1U << 0) #define IORING_ACCEPT_MULTISHOT (1U << 0)
/*
* close flags, store in sqe->close_flags
*/
#define IORING_CLOSE_FD_AND_FILE_SLOT (1U << 0)
/* /*
* IO completion data structure (Completion Queue Entry) * IO completion data structure (Completion Queue Entry)
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment