Skip to content

Commit 5402a67

Browse files
isilencegregkh
authored andcommitted
block: don't ignore REQ_NOWAIT for direct IO
[ Upstream commit f8b78ca ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent efa7b6e commit 5402a67

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎fs/block_dev.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
280280
bio.bi_opf = dio_bio_write_op(iocb);
281281
task_io_account_write(ret);
282282
}
283+
if (iocb->ki_flags & IOCB_NOWAIT)
284+
bio.bi_opf |= REQ_NOWAIT;
283285
if (iocb->ki_flags & IOCB_HIPRI)
284286
bio_set_polled(&bio, iocb);
285287

@@ -433,6 +435,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
433435
bio->bi_opf = dio_bio_write_op(iocb);
434436
task_io_account_write(bio->bi_iter.bi_size);
435437
}
438+
if (iocb->ki_flags & IOCB_NOWAIT)
439+
bio->bi_opf |= REQ_NOWAIT;
436440

437441
dio->size += bio->bi_iter.bi_size;
438442
pos += bio->bi_iter.bi_size;

0 commit comments

Comments
 (0)