Skip to content

Commit 88fc41c

Browse files
damien-lemoalmartinkpetersen
authored andcommitted
scsi: sd_zbc: Fix zone information messages
Commit bf50545 ("block: Introduce blk_revalidate_disk_zones()") inadvertently broke the message output of sd_zbc_print_zones() because the zone information initialization of the scsi disk structure was moved to the second scan run while sd_zbc_print_zones() is called on the first scan. This leads to the following incorrect message to be printed for any ZBC or ZAC zoned disks. "...[sdX] 4294967295 zones of 0 logical blocks + 1 runt zone" Fix this by initializing sdkp zone size and number of zones early on the first scan. This does not impact the execution of blk_revalidate_zones(). This functions is still called only once the block device capacity is set on the second revalidate run on boot, or if the disk zone configuration changed (i.e. the disk changed). Fixes: bf50545 ("block: Introduce blk_revalidate_disk_zones()") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent b6cd7f3 commit 88fc41c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/scsi/sd_zbc.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,16 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf)
462462
sdkp->device->use_10_for_rw = 0;
463463

464464
/*
465-
* If something changed, revalidate the disk zone bitmaps once we have
466-
* the capacity, that is on the second revalidate execution during disk
467-
* scan and always during normal revalidate.
465+
* Revalidate the disk zone bitmaps once the block device capacity is
466+
* set on the second revalidate execution during disk scan and if
467+
* something changed when executing a normal revalidate.
468468
*/
469-
if (sdkp->first_scan)
469+
if (sdkp->first_scan) {
470+
sdkp->zone_blocks = zone_blocks;
471+
sdkp->nr_zones = nr_zones;
470472
return 0;
473+
}
474+
471475
if (sdkp->zone_blocks != zone_blocks ||
472476
sdkp->nr_zones != nr_zones ||
473477
disk->queue->nr_zones != nr_zones) {

0 commit comments

Comments
 (0)