This is a note to let you know that I've just added the patch titled dm zoned: check zone capacity to the 5.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: dm-zoned-check-zone-capacity.patch and it can be found in the queue-5.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From bab68499428ed934f0493ac74197ed6f36204260 Mon Sep 17 00:00:00 2001 From: Damien Le Moal <damien.lemoal@xxxxxxx> Date: Wed, 19 May 2021 10:26:16 +0900 Subject: dm zoned: check zone capacity From: Damien Le Moal <damien.lemoal@xxxxxxx> commit bab68499428ed934f0493ac74197ed6f36204260 upstream. The dm-zoned target cannot support zoned block devices with zones that have a capacity smaller than the zone size (e.g. NVMe zoned namespaces) due to the current chunk zone mapping implementation as it is assumed that zones and chunks have the same size with all blocks usable. If a zoned drive is found to have zones with a capacity different from the zone size, fail the target initialization. Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxx> Cc: stable@xxxxxxxxxxxxxxx # v5.9+ Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/md/dm-zoned-metadata.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/md/dm-zoned-metadata.c +++ b/drivers/md/dm-zoned-metadata.c @@ -1390,6 +1390,13 @@ static int dmz_init_zone(struct blk_zone return -ENXIO; } + /* + * Devices that have zones with a capacity smaller than the zone size + * (e.g. NVMe zoned namespaces) are not supported. + */ + if (blkz->capacity != blkz->len) + return -ENXIO; + switch (blkz->type) { case BLK_ZONE_TYPE_CONVENTIONAL: set_bit(DMZ_RND, &zone->flags); Patches currently in stable-queue which might be from damien.lemoal@xxxxxxx are queue-5.12/block-introduce-bio_zone_write_locked-bio-flag.patch queue-5.12/dm-fix-dm_accept_partial_bio-relative-to-zone-manage.patch queue-5.12/dm-zoned-check-zone-capacity.patch