public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Yang Xiuwei <yangxiuwei@kylinos.cn>
Cc: io-uring@vger.kernel.org
Subject: Re: [PATCH] io_uring: fail soft links on negative IOU_COMPLETE results
Date: Fri, 13 Nov 2026 12:32:07 -0700	[thread overview]
Message-ID: <d0106b31-ad9e-414c-a32e-00877a91a0f2@kernel.dk> (raw)
In-Reply-To: <20261113094805.1881266-1-yangxiuwei@kylinos.cn>

On 11/13/26 2:48 AM, Yang Xiuwei wrote:
> Handlers such as fsync return IOU_COMPLETE with a negative cqe.res.
> The old io_req_complete() path called req_set_fail() for res < 0.
> After completions moved into the core, that check was dropped,
> so IOSQE_IO_LINK dependents kept running after the head failed.
> 
> Fixes: 97b388d70b53 ("io_uring: handle completions in the core")
> Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
> ---
>  io_uring/io_uring.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index 5db57bf675f0..742322c1fcc3 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -1540,6 +1540,8 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
>  		/* not all handlers take care of the internal restart codes */
>  		if (unlikely(req->cqe.res <= -ERESTARTSYS))
>  			req->cqe.res = io_fixup_restart_res(req->cqe.res);
> +		if (unlikely(req->cqe.res < 0))
> +			req_set_fail(req);
>  		if (issue_flags & IO_URING_F_COMPLETE_DEFER)
>  			io_req_complete_defer(req);
>  		else

Why not take the chance to improve this a bit:

if (unlikely(req->cqe.res < 0) {
	if (req->cqe.res <= -ERESTARTSYS)
		req->cqe.res = io_fixup_restart_res(req->cqe.res);
	req_set_fail(req);
}

?

-- 
Jens Axboe

      reply	other threads:[~2026-11-13 19:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  9:48 [PATCH] io_uring: fail soft links on negative IOU_COMPLETE results Yang Xiuwei
2026-11-13 19:32 ` Jens Axboe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0106b31-ad9e-414c-a32e-00877a91a0f2@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=yangxiuwei@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox