HomeFreeBSD

Improve `zpool labelclear`

Description

Improve zpool labelclear

  1. As implemented the zpool labelclear command overwrites

the calculated offsets of all four vdev labels even when only a
single valid label is found. If the device as been re-purposed
but still contains a valid label this can result in space no
longer owned by ZFS being zeroed. Prevent this by verifying
every label removed is intact before it's overwritten.

  1. Address a small bug in zpool_do_labelclear() which prevented

labelclear from working on file vdevs. Only block devices support
BLKFLSBUF, try the ioctl() but when it's reported as unsupported
this should not be fatal.

  1. Fix zpool labelclear so it can be run on vdevs which were

removed from the pool with zpool remove. Additionally, allow
intact but partial labels to be cleared as in the case of a failed
zpool attach or zpool replace.

  1. Remove LABELCLEAR and LABELREAD variables for test cases.

Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Tim Chase <tim@chase2k.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #8500
Closes #8373
Closes #6261

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on Mar 21 2019, 5:13 PM
GitHub <noreply@github.com>Committed on Mar 21 2019, 5:13 PM
Parents
rG304d469dcdcb: Add missing dmu_zfetch_fini() in dnode_move_impl()
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG066da71e7fe3: Improve `zpool labelclear` (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Mar 21 2019, 5:13 PM