Page MenuHomeFreeBSD

loader: zfs reader should check all labels
ClosedPublic

Authored by tsoome on Mar 30 2017, 3:39 PM.

Details

Summary

The current zfs reader is only checking first label from each device, however,
we do have 4 labels on device and we should check all 4 to be protected
against disk failures and incomplete label updates.

The difficulty is about the fact that 2 label copies are in front of the
pool data, and 2 are at the end, which means, we have to know the size of
the pool data area.

Since we have now the mechanism from common/disk.c to use the partition
information, it does help us in this task; however, there are still some
corner cases.

Namely, if the pool is created without partition, directly on the disk,
and firmware will give us the wrong size for the disk, we only can check
the first two label copies.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

even just reading the 2nd label is a big improvement. Thank you.

Have you tested this by say clobbering the first label?

even just reading the 2nd label is a big improvement. Thank you.

Have you tested this by say clobbering the first label?

no, but I did had printouts for label and UB instances while developing - so i had chance to see it is doing the correct thing afterall:D also there is parallel review up at illumos side: https://www.illumos.org/rb/r/250/

altho, the zfsboot.c details are a bit different there.

This revision is now accepted and ready to land.Apr 6 2017, 3:04 PM
This revision was automatically updated to reflect the committed changes.