Re: [PATCH 2/3] dm zoned: check the metadata zones before recovering a metadata set
From: Damien Le Moal
Date: Wed Dec 02 2026 - 00:58:57 EST
On 12/1/26 01:17, Yingjie Wang wrote:
> dmz_ctr_metadata() verifies that the zones of both metadata sets exist
> and are random or cache zones, but only after dmz_load_sb() has
> returned. By then, dmz_recover_mblocks() may already have written to
> these zones.
>
> The position of the secondary superblock is not checked against the
> number of metadata zones it describes either. If
> dmz_lookup_secondary_sb() finds it in the first zone searched and it
> describes two metadata zones per set, for example, recovering the
> primary set overwrites the secondary superblock that it is recovering
> from, and the table is loaded.
>
> Move the zone checks to dmz_check_sb(), and also check there that the
> zones are on the device that holds the metadata and that the secondary
> superblock is where it is expected to be. Volumes formatted with dmzadm
> are not affected, because it places the secondary set right after the
> primary one and requires both to fit on that device.
>
> This is needed before fixing dmz_lookup_secondary_sb(). Otherwise, more
> superblocks would be found and used for recovery without these checks.
>
> Fixes: 3b1a94c88b79 ("dm zoned: drive-managed zoned block device target")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Yingjie Wang <x-professor@xxxxxxxxxxx>
Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
--
Damien Le Moal
Western Digital Research