From: Benjamin Marzinski Date: Thu, 10 Apr 2025 19:49:43 +0000 (-0400) Subject: dm: fix native zone append devices on top of emulated ones X-Git-Tag: v6.16-rc1~56^2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad320ae27661f91585e00c114d1b264130f1bebe;p=thirdparty%2Fkernel%2Flinux.git dm: fix native zone append devices on top of emulated ones If a DM device that can pass down zone append commands is stacked on top of a device that emulates zone append commands, it will allocate zone append emulation resources, even though it doesn't use them. This is because the underlying device will have max_hw_zone_append_sectors set to 0 to request zone append emulation. When the DM device is stacked on top of it, it will inherit that max_hw_zone_append_sectors limit, despite being able to pass down zone append bios. Solve this by making sure max_hw_zone_append_sectors is non-zero for DM devices that do not need zone append emulation. Reviewed-by: Damien Le Moal Tested-by: Damien Le Moal Signed-off-by: Benjamin Marzinski Signed-off-by: Mikulas Patocka --- diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c index 4af78111d0b4d..0d989651eb158 100644 --- a/drivers/md/dm-zone.c +++ b/drivers/md/dm-zone.c @@ -347,11 +347,15 @@ int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q, /* * Check if zone append is natively supported, and if not, set the - * mapped device queue as needing zone append emulation. + * mapped device queue as needing zone append emulation. If zone + * append is natively supported, make sure that + * max_hw_zone_append_sectors is not set to 0. */ WARN_ON_ONCE(queue_is_mq(q)); if (!dm_table_supports_zone_append(t)) lim->max_hw_zone_append_sectors = 0; + else if (lim->max_hw_zone_append_sectors == 0) + lim->max_hw_zone_append_sectors = lim->max_zone_append_sectors; /* * Determine the max open and max active zone limits for the mapped