Skip to content

Commit 74e2411

Browse files
Fengnan Changvijay-suman
authored andcommitted
block: fix direct io NOWAIT flag not work
commit 8b44b4d81598 ("block: don't allow multiple bios for IOCB_NOWAIT issue") backport a upstream fix, but miss commit b77c88c ("block: pass a block_device and opf to bio_alloc_kiocb"), and introduce this bug. commit b77c88c ("block: pass a block_device and opf to bio_alloc_kiocb") have other depend patch, so just fix it. Fixes: 8b44b4d81598 ("block: don't allow multiple bios for IOCB_NOWAIT issue") Signed-off-by: Fengnan Chang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 4f8244e0a2f4c3eaf65d749f90925b1630f812a0) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent 2e29755 commit 74e2411

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

block/fops.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
259259
blk_finish_plug(&plug);
260260
return -EAGAIN;
261261
}
262-
bio->bi_opf |= REQ_NOWAIT;
263262
}
264263

265264
if (is_read) {
@@ -270,6 +269,10 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
270269
bio->bi_opf = dio_bio_write_op(iocb);
271270
task_io_account_write(bio->bi_iter.bi_size);
272271
}
272+
273+
if (iocb->ki_flags & IOCB_NOWAIT)
274+
bio->bi_opf |= REQ_NOWAIT;
275+
273276
dio->size += bio->bi_iter.bi_size;
274277
pos += bio->bi_iter.bi_size;
275278

0 commit comments

Comments
 (0)