Skip to content

Commit 4e4320a

Browse files
author
Ming Lei
committed
dm: split write BIOs on zone boundaries when zone append is not emulated
JIRA: https://issues.redhat.com/browse/RHEL-97177 commit 675f940 Author: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Date: Thu Jul 17 19:35:39 2025 +0900 dm: split write BIOs on zone boundaries when zone append is not emulated Commit 2df7168 ("dm: Always split write BIOs to zoned device limits") updates the device-mapper driver to perform splits for the write BIOs. However, it did not address the cases where DM targets do not emulate zone append, such as in the cases of dm-linear or dm-flakey. For these targets, when the write BIOs span across zone boundaries, they trigger WARN_ON_ONCE(bio_straddles_zones(bio)) in blk_zone_wplug_handle_write(). This results in I/O errors. The errors are reproduced by running blktests test case zbd/004 using zoned dm-linear or dm-flakey devices. To avoid the I/O errors, handle the write BIOs regardless whether DM targets emulate zone append or not, so that all write BIOs are split at zone boundaries. For that purpose, drop the check for zone append emulation in dm_zone_bio_needs_split(). Its argument 'md' is no longer used then drop it also. Fixes: 2df7168 ("dm: Always split write BIOs to zoned device limits") Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Mikulas Patocka <mpatocka@redhat.com> Link: https://lore.kernel.org/r/20250717103539.37279-1-shinichiro.kawasaki@wdc.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Ming Lei <ming.lei@redhat.com>
1 parent 7392c0a commit 4e4320a

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

drivers/md/dm.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,8 +1801,7 @@ static void init_clone_info(struct clone_info *ci, struct dm_io *io,
18011801
}
18021802

18031803
#ifdef CONFIG_BLK_DEV_ZONED
1804-
static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
1805-
struct bio *bio)
1804+
static inline bool dm_zone_bio_needs_split(struct bio *bio)
18061805
{
18071806
/*
18081807
* Special case the zone operations that cannot or should not be split.
@@ -1818,13 +1817,11 @@ static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
18181817
}
18191818

18201819
/*
1821-
* Mapped devices that require zone append emulation will use the block
1822-
* layer zone write plugging. In such case, we must split any large BIO
1823-
* to the mapped device limits to avoid potential deadlocks with queue
1824-
* freeze operations.
1820+
* When mapped devices use the block layer zone write plugging, we must
1821+
* split any large BIO to the mapped device limits to not submit BIOs
1822+
* that span zone boundaries and to avoid potential deadlocks with
1823+
* queue freeze operations.
18251824
*/
1826-
if (!dm_emulate_zone_append(md))
1827-
return false;
18281825
return bio_needs_zone_write_plugging(bio) || bio_straddles_zones(bio);
18291826
}
18301827

@@ -1948,8 +1945,7 @@ static blk_status_t __send_zone_reset_all(struct clone_info *ci)
19481945
}
19491946

19501947
#else
1951-
static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
1952-
struct bio *bio)
1948+
static inline bool dm_zone_bio_needs_split(struct bio *bio)
19531949
{
19541950
return false;
19551951
}
@@ -1976,7 +1972,7 @@ static void dm_split_and_process_bio(struct mapped_device *md,
19761972

19771973
is_abnormal = is_abnormal_io(bio);
19781974
if (static_branch_unlikely(&zoned_enabled)) {
1979-
need_split = is_abnormal || dm_zone_bio_needs_split(md, bio);
1975+
need_split = is_abnormal || dm_zone_bio_needs_split(bio);
19801976
} else {
19811977
need_split = is_abnormal;
19821978
}

0 commit comments

Comments
 (0)