Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] fs: RWF_NOWAIT should imply IOCB_NOIO
@ 2020-08-11  0:48 Jens Axboe
  2020-08-11  6:13 ` Dave Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2020-08-11  0:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Dave Chinner, linux-kernel

With the change allowing read-ahead for IOCB_NOWAIT, we changed the
RWF_NOWAIT semantics of only doing cached reads. Since we know have
IOCB_NOIO to manage that specific side of it, just make RWF_NOWAIT
imply IOCB_NOIO as well to restore the previous behavior.

Fixes: 2e85abf053b9 ("mm: allow read-ahead with IOCB_NOWAIT set")
Reported-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

---

This was a known change with the buffered async read change, but we
didn't have IOCB_NOIO until late in 5.8. Now that bases are synced,
make the change to make RWF_NOWAIT behave like past kernels.

diff --git a/include/linux/fs.h b/include/linux/fs.h
index bd7ec3eaeed0..f1cca4bfdd7b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3293,7 +3293,7 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
 	if (flags & RWF_NOWAIT) {
 		if (!(ki->ki_filp->f_mode & FMODE_NOWAIT))
 			return -EOPNOTSUPP;
-		kiocb_flags |= IOCB_NOWAIT;
+		kiocb_flags |= IOCB_NOWAIT | IOCB_NOIO;
 	}
 	if (flags & RWF_HIPRI)
 		kiocb_flags |= IOCB_HIPRI;

-- 
Jens Axboe


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

* Re: [PATCH] fs: RWF_NOWAIT should imply IOCB_NOIO
  2020-08-11  0:48 [PATCH] fs: RWF_NOWAIT should imply IOCB_NOIO Jens Axboe
@ 2020-08-11  6:13 ` Dave Chinner
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2020-08-11  6:13 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-fsdevel, linux-kernel

On Mon, Aug 10, 2020 at 06:48:19PM -0600, Jens Axboe wrote:
> With the change allowing read-ahead for IOCB_NOWAIT, we changed the
> RWF_NOWAIT semantics of only doing cached reads. Since we know have
> IOCB_NOIO to manage that specific side of it, just make RWF_NOWAIT
> imply IOCB_NOIO as well to restore the previous behavior.
> 
> Fixes: 2e85abf053b9 ("mm: allow read-ahead with IOCB_NOWAIT set")
> Reported-by: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> 
> ---
> 
> This was a known change with the buffered async read change, but we
> didn't have IOCB_NOIO until late in 5.8. Now that bases are synced,
> make the change to make RWF_NOWAIT behave like past kernels.
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index bd7ec3eaeed0..f1cca4bfdd7b 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3293,7 +3293,7 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
>  	if (flags & RWF_NOWAIT) {
>  		if (!(ki->ki_filp->f_mode & FMODE_NOWAIT))
>  			return -EOPNOTSUPP;
> -		kiocb_flags |= IOCB_NOWAIT;
> +		kiocb_flags |= IOCB_NOWAIT | IOCB_NOIO;
>  	}
>  	if (flags & RWF_HIPRI)
>  		kiocb_flags |= IOCB_HIPRI;

Looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

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

end of thread, other threads:[~2020-08-11  6:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11  0:48 [PATCH] fs: RWF_NOWAIT should imply IOCB_NOIO Jens Axboe
2020-08-11  6:13 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).