Skip to content

Commit cd6521d

Browse files
author
Mikulas Patocka
committed
dm: disable REQ_NOWAIT for flushes
REQ_NOWAIT for flushes cannot be easily supported by device mapper because it may allocate multiple bios and its impossible to undo if one of those allocations wants to wait. So, this patch disables REQ_NOWAIT flushes in device mapper and we always return EAGAIN. Previously, the code accepted REQ_NOWAIT flushes, but the non-blocking execution was not guaranteed. Signed-off-by: Mikulas Patocka <[email protected]>
1 parent 6942348 commit cd6521d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/md/dm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,6 +1968,15 @@ static void dm_split_and_process_bio(struct mapped_device *md,
19681968

19691969
/* Only support nowait for normal IO */
19701970
if (unlikely(bio->bi_opf & REQ_NOWAIT) && !is_abnormal) {
1971+
/*
1972+
* Don't support NOWAIT for FLUSH because it may allocate
1973+
* multiple bios and there's no easy way how to undo the
1974+
* allocations.
1975+
*/
1976+
if (bio->bi_opf & REQ_PREFLUSH) {
1977+
bio_wouldblock_error(bio);
1978+
return;
1979+
}
19711980
io = alloc_io(md, bio, GFP_NOWAIT);
19721981
if (unlikely(!io)) {
19731982
/* Unable to do anything without dm_io. */

0 commit comments

Comments
 (0)