Page MenuHomeFreeBSD

stand/zfs: don't fail boot if the first label is broken
AbandonedPublic

Authored by p.bruenn_beckhoff.com on May 19 2019, 10:58 PM.
Tags
None
Referenced Files
F105324123: D20319.diff
Sat, Dec 14, 10:31 PM
Unknown Object (File)
Sun, Nov 17, 7:41 PM
Unknown Object (File)
Sat, Nov 16, 7:45 AM
Unknown Object (File)
Oct 26 2024, 7:52 AM
Unknown Object (File)
Oct 18 2024, 11:36 AM
Unknown Object (File)
Oct 18 2024, 10:44 AM
Unknown Object (File)
Oct 2 2024, 2:16 PM
Unknown Object (File)
Oct 1 2024, 7:27 AM
Subscribers

Details

Summary

Booting from a vdev with a broken first label will fail, because
vdev_probe() never tries to read the next label. This revision calls
retries vdev_probe() until a good label was found or all labels are
broken.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24326
Build 23149: arc lint + arc unit

Event Timeline

Something is off there. The for loop in vdev_probe() does continue in case of failures, but is intended to walk through all 4 labels, so why do we fail?

Yes, but not for all failures. If a label is found in the loop but later the associated data found invalid the vdev_probe() will fail even if there would be another label with better data.

Yes, but not for all failures. If a label is found in the loop but later the associated data found invalid the vdev_probe() will fail even if there would be another label with better data.

right, I see. I suggest to rework this solution even more; to something like:

vdev_probe()
{

 for (i = 0; i < VDEV_LABELS; i++) {
   vdev_read_label(i, &ub, &nvl);
   check if received  ub and nvl  are better than current.
}
if we have no good ub and nvl
  fail.

}

and vdev_read_label should read the specific label, perform initial tests and return good data.

This way we do not have to play the games with those fancy constants and games with inserting/deleting spa and vdev data.

Agreed, a sane vdev_probe() would be nice. But I have totally no idea how you want to omit cleaning up partially initialized spa/vdev objects without rewriting the whole file. Either some of the current error paths are dead code or things like vdev_init_from_nvlist() have to be replaced.

Agreed, a sane vdev_probe() would be nice. But I have totally no idea how you want to omit cleaning up partially initialized spa/vdev objects without rewriting the whole file. Either some of the current error paths are dead code or things like vdev_init_from_nvlist() have to be replaced.

I do not think that rewriting the whole file is needed:) And true, we probably need some configuration release during the process.

This change was merge as commit 5f37265777ec9475a5382654cbf4ae27d927c41a