summaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-11-20 17:10:28 +0000
committerJens Axboe <axboe@kernel.dk>2021-04-02 08:34:30 -0600
commitf8b78caf21d5bc3fcfc40c18898f9d52ed1451a5 (patch)
treea0647e87fb73c8e7599cff05766f93f38d603de9 /fs/block_dev.c
parentde3510e52b0a398261271455562458003b8eea62 (diff)
downloadlinux-f8b78caf21d5bc3fcfc40c18898f9d52ed1451a5.tar.gz
linux-f8b78caf21d5bc3fcfc40c18898f9d52ed1451a5.tar.bz2
linux-f8b78caf21d5bc3fcfc40c18898f9d52ed1451a5.zip
block: don't ignore REQ_NOWAIT for direct IO
If IOCB_NOWAIT is set on submission, then that needs to get propagated to REQ_NOWAIT on the block side. Otherwise we completely lose this information, and any issuer of IOCB_NOWAIT IO will potentially end up blocking on eg request allocation on the storage side. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 28d583fcdc2c..09d6f7229db9 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -275,6 +275,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
bio.bi_opf = dio_bio_write_op(iocb);
task_io_account_write(ret);
}
+ if (iocb->ki_flags & IOCB_NOWAIT)
+ bio.bi_opf |= REQ_NOWAIT;
if (iocb->ki_flags & IOCB_HIPRI)
bio_set_polled(&bio, iocb);
@@ -428,6 +430,8 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
bio->bi_opf = dio_bio_write_op(iocb);
task_io_account_write(bio->bi_iter.bi_size);
}
+ if (iocb->ki_flags & IOCB_NOWAIT)
+ bio->bi_opf |= REQ_NOWAIT;
dio->size += bio->bi_iter.bi_size;
pos += bio->bi_iter.bi_size;