Re: [PATCH 3/3] dm zoned: fix the search for the secondary superblock
From: Hannes Reinecke
Date: Thu Dec 03 2026 - 03:03:53 EST
On 11/30/26 5:17 PM, Yingjie Wang wrote:
If the primary superblock of a volume formatted with dmzadm isReviewed-by: Hannes Reinecke <hare@xxxxxxxxxx>
corrupted, dmz_lookup_secondary_sb() fails to find the valid secondary
one in two cases:
- After the first iteration, sb[1].block is advanced to the next zone,
but sb[1].zone is set to the zone that was just examined. Unless
the superblock is in the first zone that is searched, dmz_check_sb()
then rejects it because it does not appear to be in the right zone.
With 256 MiB zones, this affects volumes larger than about 8.8 TB,
which need more than one zone per metadata set:
Invalid superblock position (is 131072 expected 65536)
- The number of random zones is used as the limit. With multiple
devices, the metadata is on the cache device instead, and nothing is
searched at all if the zoned devices have no random zones. Commit
b38c0ad57f8e ("dm zoned: Fix metadata zone size check") fixed the
same problem in dmz_check_sb().
Set the block and the zone together at the start of each iteration, and
use the number of cache zones if there are multiple devices.
This depends on the previous patch, which rejects superblocks that must
not be used for recovery.
Fixes: a92fbc446d1a ("dm zoned: convert to xarray")
Fixes: 34f5affd04c4 ("dm zoned: separate random and cache zones")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Yingjie Wang <x-professor@xxxxxxxxxxx>
---
drivers/md/dm-zoned-metadata.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@xxxxxxx +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich