Re: [PATCH] io_uring/rw: fix missing ERESTARTSYS conversion in read paths

Jens Axboe <[email protected]> Wed, 22 Jul 2026 04:32:40 -0600
Newsgroups org.kernel.vger.io-uring
Message-ID <[email protected]>
On 7/20/26 5:41 AM, Yitang Yang wrote:
> Both read and write may receive internal restart error codes from
> the filesystem layer and should be converted to -EINTR. However,
> when multishot read support was added, the error code normalization
> was lost for both io_read() and io_read_mshot().
> 
> Extract the conversion into io_fixup_restart_res() and apply it
> in all three locations: io_rw_done(), io_read(), and io_read_mshot().

Functionally this looks good, just a few cosmetic nits below.

> Fixes: a08d195b586a ("io_uring/rw: split io_read() into a helper")
> Signed-off-by: Yitang Yang <[email protected]>

And this one needs a Cc: [email protected]

> @@ -625,19 +643,7 @@ static inline void io_rw_done(struct io_kiocb *req, ssize_t ret)
>  
>  	/* transform internal restart error codes */
>  	if (unlikely(ret < 0)) {
> -		switch (ret) {
> -		case -ERESTARTSYS:
> -		case -ERESTARTNOINTR:
> -		case -ERESTARTNOHAND:
> -		case -ERESTART_RESTARTBLOCK:
> -			/*
> -			 * We can't just restart the syscall, since previously
> -			 * submitted sqes may already be in progress. Just fail
> -			 * this IO with EINTR.
> -			 */
> -			ret = -EINTR;
> -			break;
> -		}
> +		ret = io_fixup_restart_res(ret);
>  	}

No need for braces anymore on the 'if' statement, just drop those.

> @@ -1034,6 +1040,8 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags)
>  
>  	if (req->flags & REQ_F_BUFFERS_COMMIT)
>  		io_kbuf_recycle(req, sel.buf_list, issue_flags);
> +
> +	ret = io_fixup_restart_res(ret);
>  	return ret;
>  }

return io_fixup_restart_res(ret);

-- 
Jens Axboe