summaryrefslogtreecommitdiffstats
path: root/drivers/block/null_blk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:14:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:14:24 +0000
commit2a52f25b89f9c781d2c12d014354226ea2c13598 (patch)
treeb80137d1aa25be55602c98b5388327ab874bd1af /drivers/block/null_blk
parentAdding debian version 6.9.8-1. (diff)
downloadlinux-2a52f25b89f9c781d2c12d014354226ea2c13598.tar.xz
linux-2a52f25b89f9c781d2c12d014354226ea2c13598.zip
Merging upstream version 6.9.9.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/block/null_blk')
-rw-r--r--drivers/block/null_blk/zoned.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c
index 27928deccc..74d0418dda 100644
--- a/drivers/block/null_blk/zoned.c
+++ b/drivers/block/null_blk/zoned.c
@@ -84,6 +84,17 @@ int null_init_zoned_dev(struct nullb_device *dev,
return -EINVAL;
}
+ /*
+ * If a smaller zone capacity was requested, do not allow a smaller last
+ * zone at the same time as such zone configuration does not correspond
+ * to any real zoned device.
+ */
+ if (dev->zone_capacity != dev->zone_size &&
+ dev->size & (dev->zone_size - 1)) {
+ pr_err("A smaller last zone is not allowed with zone capacity smaller than zone size.\n");
+ return -EINVAL;
+ }
+
zone_capacity_sects = mb_to_sects(dev->zone_capacity);
dev_capacity_sects = mb_to_sects(dev->size);
dev->zone_size_sects = mb_to_sects(dev->zone_size);