Skip to content

Commit d884b64

Browse files
isilenceaxboe
authored andcommitted
io_uring: remove IORING_CLOSE_FD_AND_FILE_SLOT
This partially reverts a7c41b4 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: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/837c745019b3795941eee4fcfd7de697886d645b.1655224415.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent aa165d6 commit d884b64

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

fs/io_uring.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,6 @@ struct io_close {
576576
struct file *file;
577577
int fd;
578578
u32 file_slot;
579-
u32 flags;
580579
};
581580

582581
struct io_timeout_data {
@@ -5966,18 +5965,14 @@ static int io_statx(struct io_kiocb *req, unsigned int issue_flags)
59665965

59675966
static int io_close_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
59685967
{
5969-
if (sqe->off || sqe->addr || sqe->len || sqe->buf_index)
5968+
if (sqe->off || sqe->addr || sqe->len || sqe->rw_flags || sqe->buf_index)
59705969
return -EINVAL;
59715970
if (req->flags & REQ_F_FIXED_FILE)
59725971
return -EBADF;
59735972

59745973
req->close.fd = READ_ONCE(sqe->fd);
59755974
req->close.file_slot = READ_ONCE(sqe->file_index);
5976-
req->close.flags = READ_ONCE(sqe->close_flags);
5977-
if (req->close.flags & ~IORING_CLOSE_FD_AND_FILE_SLOT)
5978-
return -EINVAL;
5979-
if (!(req->close.flags & IORING_CLOSE_FD_AND_FILE_SLOT) &&
5980-
req->close.file_slot && req->close.fd)
5975+
if (req->close.file_slot && req->close.fd)
59815976
return -EINVAL;
59825977

59835978
return 0;
@@ -5993,8 +5988,7 @@ static int io_close(struct io_kiocb *req, unsigned int issue_flags)
59935988

59945989
if (req->close.file_slot) {
59955990
ret = io_close_fixed(req, issue_flags);
5996-
if (ret || !(req->close.flags & IORING_CLOSE_FD_AND_FILE_SLOT))
5997-
goto err;
5991+
goto err;
59985992
}
59995993

60005994
spin_lock(&files->file_lock);

include/uapi/linux/io_uring.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ struct io_uring_sqe {
4747
__u32 unlink_flags;
4848
__u32 hardlink_flags;
4949
__u32 xattr_flags;
50-
__u32 close_flags;
5150
};
5251
__u64 user_data; /* data to be passed back at completion time */
5352
/* pack this to avoid bogus arm OABI complaints */
@@ -259,11 +258,6 @@ enum io_uring_op {
259258
*/
260259
#define IORING_ACCEPT_MULTISHOT (1U << 0)
261260

262-
/*
263-
* close flags, store in sqe->close_flags
264-
*/
265-
#define IORING_CLOSE_FD_AND_FILE_SLOT (1U << 0)
266-
267261
/*
268262
* IO completion data structure (Completion Queue Entry)
269263
*/

0 commit comments

Comments
 (0)