io_uring: fix submission-failure handling for uring-cmd
A message that is not in the archive (sent off-list or not yet received): CGME20220823152018epcas5p3141ae99b73ba495f1501723d7834ee32@epcas5p3.samsung.com
PATCH 1/1 io_uring: fix submission-failure handling for uring-cmd
If ->uring_cmd returned an error value different from -EAGAIN or -EIOCBQUEUED, it gets overridden with IOU_OK. This invites trouble as caller (io_uring core code) handles IOU_OK differently than other error codes.
Fix this by returning the actual error code.
--- io_uring/uring_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/uring_cmd.c +1 -1
@@ -119,7 +119,7 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)if (ret <0 )req_set_fail (req);io_req_set_res (req, ret,0 ); -return IOU_OK ; +return ret; }return IOU_ISSUE_SKIP_COMPLETE ;
Signature · 1 line
2.25.1
Quoted 5 lines · Kanchan Joshi
If ->uring_cmd returned an error value different from
-EAGAINor-EIOCBQUEUED, it gets overridden withIOU_OK. This invites trouble as caller (io_uringcore code) handlesIOU_OKdifferently than other error codes.
Fix this by returning the actual error code.
Not sure if this is strictly needed, as the cqe error is set just fine. But I guess some places also check return value of the issue path.
Applied.
Signature · 1 line
Jens Axboe
Quoted 10 lines · Jens Axboe
Quoted 5 lines · Kanchan Joshi
If ->uring_cmd returned an error value different from
-EAGAINor-EIOCBQUEUED, it gets overridden withIOU_OK. This invites trouble as caller (io_uringcore code) handlesIOU_OKdifferently than other error codes.
Fix this by returning the actual error code.Not sure if this is strictly needed, as the cqe error is set just fine. But I guess some places also check return value of the issue path.
So I was testing iopoll support and ran into this issue - submission failed (expected one), control came back to this point, error code got converted to IOU_OK, and it started polling endlessly for a command that never got submitted.io_issue_sqe continued to invoke io_iopoll_req_issued() rather than bailing out.
Jens Axboe
maintainerQuoted 12 lines · Kanchan Joshi
Quoted 10 lines · Jens Axboe
Quoted 5 lines · Kanchan Joshi
If ->uring_cmd returned an error value different from
-EAGAINor-EIOCBQUEUED, it gets overridden withIOU_OK. This invites trouble as caller (io_uringcore code) handlesIOU_OKdifferently than other error codes.
Fix this by returning the actual error code.Not sure if this is strictly needed, as the cqe error is set just fine. But I guess some places also check return value of the issue path.
Quoted 6 lines
So I was testing iopoll support and ran into this issue - submission failed (expected one), control came back to this point, error code got converted to
IOU_OK, and it started polling endlessly for a command that never got submitted.io_issue_sqecontinued to invokeio_iopoll_req_issued()rather than bailing out.
Ah ok, yes for iopoll it'd make a difference...
Signature · 1 line
Jens Axboe