fs: RWF_NOWAIT should imply IOCB_NOIO
authorJens Axboe <axboe@kernel.dk>
Tue, 11 Aug 2020 00:44:24 +0000 (18:44 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 11 Aug 2020 14:09:01 +0000 (08:09 -0600)
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>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/fs.h

index bd7ec3eaeed0cd59b97fd8bc3986bcb67aa135fc..f1cca4bfdd7baf0bccdb19f5fc021d0ec65e48ba 100644 (file)
@@ -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;