Page MenuHomeFreeBSD

libsa/zfs: further improve handling of stale labels
ClosedPublic

Authored by glebius on Aug 15 2025, 5:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 12, 6:12 PM
Unknown Object (File)
Sat, Oct 11, 8:07 AM
Unknown Object (File)
Sat, Oct 11, 8:07 AM
Unknown Object (File)
Sat, Oct 11, 8:07 AM
Unknown Object (File)
Sat, Oct 11, 8:07 AM
Unknown Object (File)
Sat, Oct 11, 8:07 AM
Unknown Object (File)
Sat, Oct 11, 12:46 AM
Unknown Object (File)
Wed, Oct 8, 8:43 PM
Subscribers

Details

Summary

Fix two problems with 6dd0803ffd31. First problem is that situation when
newer label was read before stale one, was handled differently to reverse
order case. Second problem is that vdev_free() would free the fully
initialized leaf vdev that carried stale label. In a case when vdev
carries a stale label, but is still referenced by a different label with
new a configuration, we don't want to free it, but rather insert it into
the new configuration.

Provide a helper function nvlist_find_vdev_guid() that checks presence
of certain GUID in a label.

In top level vdev store the GUID of vdev used to instantiate top vdev.

Cover all possible cases in the block in vdev_probe() where we encounter
a known configuration.  Make the diagnostic print more informative and
looking same regardless of probe order.  Make this whole block easier to
read reducing one level of indentation for a price of a single comparison
  at runtime.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Aug 18 2025, 10:55 PM
glebius retitled this revision from libsa/zfs: improve printing when encountering a stale disk to libsa/zfs: further improve handling of stale labels.Aug 19 2025, 8:58 PM
glebius edited the summary of this revision. (Show Details)
glebius edited the summary of this revision. (Show Details)

Rewrite this revision based on feedback from Alexander.

Make sure that we don't free leaf vdevs with initialized v_phys_read so
that they can be reused if referenced by a new label. Make printing
better and summetrical against probing sequence.

This revision now requires review to proceed.Aug 19 2025, 9:00 PM

The logic of printing looks excessively complicated, but otherwise seems to make sense.

This revision is now accepted and ready to land.Aug 19 2025, 11:29 PM

I agree this is a bit ugly, but it seems a bit clearer than before...