diff mbox series

block: Improve blk_revalidate_disk_zones() checks

Message ID 20201111055406.735839-1-damien.lemoal@wdc.com (mailing list archive)
State New, archived
Headers show
Series block: Improve blk_revalidate_disk_zones() checks | expand

Commit Message

Damien Le Moal Nov. 11, 2020, 5:54 a.m. UTC
Make sure that the zones checked by blk_revalidate_disk_zones() exactly
cover the entire disk capacity, that is, that there are no missing zones
at the end of the disk sector range.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 block/blk-zoned.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 6817a673e5ce..2821de36a5a9 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -510,6 +510,13 @@  int blk_revalidate_disk_zones(struct gendisk *disk,
 				       blk_revalidate_zone_cb, &args);
 	memalloc_noio_restore(noio_flag);
 
+	/* Make sure that the entire disk capacity has been checked */
+	if (args.sector != get_capacity(disk)) {
+		pr_warn("%s: Missing zones from sector %llu\n",
+			disk->disk_name, args.sector);
+		ret = -ENODEV;
+	}
+
 	/*
 	 * Install the new bitmaps and update nr_zones only once the queue is
 	 * stopped and all I/Os are completed (i.e. a scheduler is not