file assignment issues
cover file assignment issues
small fixes for deferred file assignment
Pavel Begunkov (3):
io_uring: use right issue_flags for splice/tee
io_uring: fix poll file assign deadlock
io_uring: fix poll error reporting
fs/io_uring.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.35.1
PATCH 1/3 io_uring: use right issue_flags for splice/tee
Pass right issue_flags into into io_file_get_fixed() instead of IO_URING_F_UNLOCKED. It's probably not a problem at the moment but let's do it safer.
--- fs/io_uring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/io_uring.c +2 -2
@@ -4358,7 +4358,7 @@ static int io_tee(struct io_kiocb *req, unsigned int issue_flags)return -EAGAIN ;if (sp->flags &SPLICE_F_FD_IN_FIXED ) - in =io_file_get_fixed (req, sp->splice_fd_in,IO_URING_F_UNLOCKED ); + in =io_file_get_fixed (req, sp->splice_fd_in, issue_flags);else in =io_file_get_normal (req, sp->splice_fd_in);if (!in) {
@@ -4400,7 +4400,7 @@ static int io_splice(struct io_kiocb *req, unsigned int issue_flags)return -EAGAIN ;if (sp->flags &SPLICE_F_FD_IN_FIXED ) - in =io_file_get_fixed (req, sp->splice_fd_in,IO_URING_F_UNLOCKED ); + in =io_file_get_fixed (req, sp->splice_fd_in, issue_flags);else in =io_file_get_normal (req, sp->splice_fd_in);if (!in) {
Signature · 1 line
2.35.1
PATCH 2/3 io_uring: fix poll file assign deadlock
In reply to Pavel BegunkovWe pass "unlocked" into io_assign_file() in io_poll_check_events(), which can lead to double locking.
--- fs/io_uring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/io_uring.c +2 -1
@@ -5858,8 +5858,9 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked)if (!req->result) {struct poll_table_struct pt = { ._key = req->apoll_events }; +unsigned flags = locked ?0 :IO_URING_F_UNLOCKED ; -if (unlikely (!io_assign_file (req,IO_URING_F_UNLOCKED ))) +if (unlikely (!io_assign_file (req, flags))) req->result = -EBADF ;else req->result =vfs_poll (req->file, &pt) & req->apoll_events;
Signature · 1 line
2.35.1
PATCH 3/3 io_uring: fix poll error reporting
In reply to Pavel BegunkovWe should not return an error code in req->result in io_poll_check_events(), because it may get mangled and returned as success. Just return the error code directly, the callers will fail the request or proceed accordingly.
--- fs/io_uring.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/io_uring.c +2 -3
@@ -5861,9 +5861,8 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked)unsigned flags = locked ?0 :IO_URING_F_UNLOCKED ;if (unlikely (!io_assign_file (req, flags))) - req->result = -EBADF ; -else - req->result =vfs_poll (req->file, &pt) & req->apoll_events; +return -EBADF ; + req->result =vfs_poll (req->file, &pt) & req->apoll_events; }/* multishot, just fill an CQE and proceed */
Signature · 1 line
2.35.1
Quoted 8 lines · Pavel Begunkov
small fixes for deferred file assignment
Pavel Begunkov (3):
io_uring: use rightissue_flagsfor splice/tee
io_uring: fix poll file assign deadlock
io_uring: fix poll error reporting[...]
Applied, thanks!
[1/3] io_uring: use right issue_flags for splice/tee
commit: e941976659f1f6834077a1596bf53e6bdb10e90b
[2/3] io_uring: fix poll file assign deadlock
commit: cce64ef01308b677a687d90927fc2b2e0e1cba67
[3/3] io_uring: fix poll error reporting
commit: 7179c3ce3dbff646c55f7cd664a895f462f049e5Best regards,
Signature · 1 line
Jens Axboe