Skip to content

Commit 675f940

Browse files
kawasakiaxboe
authored andcommitted
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 <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Mikulas Patocka <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 63d092d commit 675f940

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

drivers/md/dm.c

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

17871787
#ifdef CONFIG_BLK_DEV_ZONED
1788-
static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
1789-
struct bio *bio)
1788+
static inline bool dm_zone_bio_needs_split(struct bio *bio)
17901789
{
17911790
/*
17921791
* Special case the zone operations that cannot or should not be split.
@@ -1802,13 +1801,11 @@ static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
18021801
}
18031802

18041803
/*
1805-
* Mapped devices that require zone append emulation will use the block
1806-
* layer zone write plugging. In such case, we must split any large BIO
1807-
* to the mapped device limits to avoid potential deadlocks with queue
1808-
* freeze operations.
1804+
* When mapped devices use the block layer zone write plugging, we must
1805+
* split any large BIO to the mapped device limits to not submit BIOs
1806+
* that span zone boundaries and to avoid potential deadlocks with
1807+
* queue freeze operations.
18091808
*/
1810-
if (!dm_emulate_zone_append(md))
1811-
return false;
18121809
return bio_needs_zone_write_plugging(bio) || bio_straddles_zones(bio);
18131810
}
18141811

@@ -1932,8 +1929,7 @@ static blk_status_t __send_zone_reset_all(struct clone_info *ci)
19321929
}
19331930

19341931
#else
1935-
static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
1936-
struct bio *bio)
1932+
static inline bool dm_zone_bio_needs_split(struct bio *bio)
19371933
{
19381934
return false;
19391935
}
@@ -1960,7 +1956,7 @@ static void dm_split_and_process_bio(struct mapped_device *md,
19601956

19611957
is_abnormal = is_abnormal_io(bio);
19621958
if (static_branch_unlikely(&zoned_enabled)) {
1963-
need_split = is_abnormal || dm_zone_bio_needs_split(md, bio);
1959+
need_split = is_abnormal || dm_zone_bio_needs_split(bio);
19641960
} else {
19651961
need_split = is_abnormal;
19661962
}

0 commit comments

Comments
 (0)