diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2025-01-09 16:49:11 +0300 |
---|---|---|
committer | Mikulas Patocka <mpatocka@redhat.com> | 2025-01-18 00:05:39 +0300 |
commit | cd6521d03f6a722f18fc027f0d289c39d164dc4f (patch) | |
tree | dc8b5e72e76d6b23f383c969e703ec7c33080efd /drivers/md | |
parent | 6942348d1bbdb612bc14025cab467fd1f012abe8 (diff) | |
download | linux-cd6521d03f6a722f18fc027f0d289c39d164dc4f.tar.xz |
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 <mpatocka@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 4817ef1206a9..ee86cc60d4b8 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1968,6 +1968,15 @@ static void dm_split_and_process_bio(struct mapped_device *md, /* Only support nowait for normal IO */ if (unlikely(bio->bi_opf & REQ_NOWAIT) && !is_abnormal) { + /* + * Don't support NOWAIT for FLUSH because it may allocate + * multiple bios and there's no easy way how to undo the + * allocations. + */ + if (bio->bi_opf & REQ_PREFLUSH) { + bio_wouldblock_error(bio); + return; + } io = alloc_io(md, bio, GFP_NOWAIT); if (unlikely(!io)) { /* Unable to do anything without dm_io. */ |