diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2021-05-19 03:26:16 +0200 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2021-06-04 18:07:28 +0200 |
commit | bab68499428ed934f0493ac74197ed6f36204260 (patch) | |
tree | 278195754b009ed5b5a3c75cc40e3d6e63d0fe89 /drivers/md | |
parent | dm table: Constify static struct blk_ksm_ll_ops (diff) | |
download | linux-bab68499428ed934f0493ac74197ed6f36204260.tar.xz linux-bab68499428ed934f0493ac74197ed6f36204260.zip |
dm zoned: check zone capacity
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@wdc.com>
Cc: stable@vger.kernel.org # v5.9+
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-zoned-metadata.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c index 039d17b28938..ee4626d08557 100644 --- 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 *blkz, unsigned int num, void *data) 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); |