public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: don't set REQ_F_NOWAIT if the file was opened O_NONBLOCK
@ 2020-05-25 10:48 Jiufei Xue
  2020-05-26  1:17 ` Jiufei Xue
  0 siblings, 1 reply; 2+ messages in thread
From: Jiufei Xue @ 2020-05-25 10:48 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, joseph.qi

When read from an ondisk file that was opened O_NONBLOCK, it will always
return EAGAIN to the user if the page is not cached. It is not
compatible with interfaces such as aio_read() and normal sys_read().

Files that care about this flag (eg. pipe, eventfd) will deal with it
on their own. So I don't think we should set REQ_F_NOWAIT in
io_prep_rw() to provent from queueing the async work.

Signed-off-by: Jiufei Xue <[email protected]>
---
 fs/io_uring.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index bb25e39..65ae59b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2080,8 +2080,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
 		kiocb->ki_ioprio = get_current_ioprio();
 
 	/* don't allow async punt if RWF_NOWAIT was requested */
-	if ((kiocb->ki_flags & IOCB_NOWAIT) ||
-	    (req->file->f_flags & O_NONBLOCK))
+	if (kiocb->ki_flags & IOCB_NOWAIT)
 		req->flags |= REQ_F_NOWAIT;
 
 	if (force_nonblock)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] io_uring: don't set REQ_F_NOWAIT if the file was opened O_NONBLOCK
  2020-05-25 10:48 [PATCH] io_uring: don't set REQ_F_NOWAIT if the file was opened O_NONBLOCK Jiufei Xue
@ 2020-05-26  1:17 ` Jiufei Xue
  0 siblings, 0 replies; 2+ messages in thread
From: Jiufei Xue @ 2020-05-26  1:17 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, joseph.qi

I think we should not set the flag only for regular file,
I will resend it later. Please ignore this patch.

Thanks,
Jiufei

On 2020/5/25 下午6:48, Jiufei Xue wrote:
> When read from an ondisk file that was opened O_NONBLOCK, it will always
> return EAGAIN to the user if the page is not cached. It is not
> compatible with interfaces such as aio_read() and normal sys_read().
> 
> Files that care about this flag (eg. pipe, eventfd) will deal with it
> on their own. So I don't think we should set REQ_F_NOWAIT in
> io_prep_rw() to provent from queueing the async work.
> 
> Signed-off-by: Jiufei Xue <[email protected]>
> ---
>  fs/io_uring.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index bb25e39..65ae59b 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2080,8 +2080,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
>  		kiocb->ki_ioprio = get_current_ioprio();
>  
>  	/* don't allow async punt if RWF_NOWAIT was requested */
> -	if ((kiocb->ki_flags & IOCB_NOWAIT) ||
> -	    (req->file->f_flags & O_NONBLOCK))
> +	if (kiocb->ki_flags & IOCB_NOWAIT)
>  		req->flags |= REQ_F_NOWAIT;
>  
>  	if (force_nonblock)
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-26  1:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-25 10:48 [PATCH] io_uring: don't set REQ_F_NOWAIT if the file was opened O_NONBLOCK Jiufei Xue
2020-05-26  1:17 ` Jiufei Xue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox