Skip to content

Commit 6461965

Browse files
kawasakigregkh
authored andcommitted
dm: split write BIOs on zone boundaries when zone append is not emulated
commit 675f940 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5473361 commit 6461965

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
@@ -1776,8 +1776,7 @@ static void init_clone_info(struct clone_info *ci, struct dm_io *io,
17761776
}
17771777

17781778
#ifdef CONFIG_BLK_DEV_ZONED
1779-
static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
1780-
struct bio *bio)
1779+
static inline bool dm_zone_bio_needs_split(struct bio *bio)
17811780
{
17821781
/*
17831782
* Special case the zone operations that cannot or should not be split.
@@ -1793,13 +1792,11 @@ static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
17931792
}
17941793

17951794
/*
1796-
* Mapped devices that require zone append emulation will use the block
1797-
* layer zone write plugging. In such case, we must split any large BIO
1798-
* to the mapped device limits to avoid potential deadlocks with queue
1799-
* freeze operations.
1795+
* When mapped devices use the block layer zone write plugging, we must
1796+
* split any large BIO to the mapped device limits to not submit BIOs
1797+
* that span zone boundaries and to avoid potential deadlocks with
1798+
* queue freeze operations.
18001799
*/
1801-
if (!dm_emulate_zone_append(md))
1802-
return false;
18031800
return bio_needs_zone_write_plugging(bio) || bio_straddles_zones(bio);
18041801
}
18051802

@@ -1923,8 +1920,7 @@ static blk_status_t __send_zone_reset_all(struct clone_info *ci)
19231920
}
19241921

19251922
#else
1926-
static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
1927-
struct bio *bio)
1923+
static inline bool dm_zone_bio_needs_split(struct bio *bio)
19281924
{
19291925
return false;
19301926
}
@@ -1951,7 +1947,7 @@ static void dm_split_and_process_bio(struct mapped_device *md,
19511947

19521948
is_abnormal = is_abnormal_io(bio);
19531949
if (static_branch_unlikely(&zoned_enabled)) {
1954-
need_split = is_abnormal || dm_zone_bio_needs_split(md, bio);
1950+
need_split = is_abnormal || dm_zone_bio_needs_split(bio);
19551951
} else {
19561952
need_split = is_abnormal;
19571953
}

0 commit comments

Comments
 (0)