Skip to content

Commit 24dce1c

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix lost getsockopt completions
There is a report that iowq executed getsockopt never completes. The reason being that io_uring_cmd_sock() can return a positive result, and io_uring_cmd() propagates it back to core io_uring, instead of IOU_OK. In case of io_wq_submit_work(), the request will be dropped without completing it. The offending code was introduced by a hack in a9c3eda ("io_uring: fix submission-failure handling for uring-cmd"), however it was fine until getsockopt was introduced and started returning positive results. The right solution is to always return IOU_OK, since e0b23d9 ("io_uring: optimise ltimeout for inline execution"), we should be able to do it without problems, however for the sake of backporting and minimising side effects, let's keep returning negative return codes and otherwise do IOU_OK. Link: axboe/liburing#1181 Cc: stable@vger.kernel.org Fixes: 8e9fad0 ("io_uring: Add io_uring command support for sockets") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Reviewed-by: Breno Leitao <leitao@debian.org> Link: https://lore.kernel.org/r/ff349cf0654018189b6077e85feed935f0f8839e.1721149870.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent f557af0 commit 24dce1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

io_uring/uring_cmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)
265265
req_set_fail(req);
266266
io_req_uring_cleanup(req, issue_flags);
267267
io_req_set_res(req, ret, 0);
268-
return ret;
268+
return ret < 0 ? ret : IOU_OK;
269269
}
270270

271271
int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,

0 commit comments

Comments
 (0)