Fix ZED auto-replace for VDEVs using by-id paths #15363
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
The ZFS auto-replace mechanism will detect a blank disk inserted for a degraded/faulted VDEV and automatically partition the disk and issue a VDEV replacement.
There are two different
/dev/disk/by-xxx
paths involved, aby-id
and aby-vdev
.In the 'by-vdev' case, the path is both a persistent and physical path.
In the 'by-id' case, the path is persistent and also a unique path.
During an auto-replace, the newly partition disk will have a different 'by-id' name, however the 'by-vdev' name will not change.
A regression in the distant past, changed the ZED auto-replace code such that it is attempting to use the old 'by-id' name during the replacement but that name no longer exists in the 'by-id' namespace. This causes the auto-replace operation to fail.
Note that since the 'by-vdev' names don't change, it's perfectly fine to use the previous VDEV path when dev paths are 'by-vdev'.
Description
The change is simple -- restore the original code so that the VDEV path is updated when using by-id paths.
The more challenging part was to devise a second ZTS test, that would test auto-replace for 'by-id' and help prevent a future regression.
With that new test, we can now do an A|B test with , and without, the fix to confirm that auto-replace for by-id paths works. The existing auto-replace test,
functional/fault/auto_replace_001_pos
, will confirm that we didn't break auto-replace for 'by-vdev' paths.In the original
functional/fault/auto_replace_001_pos test
, the disk wipe (usingdd
) was not effective in removing the partitioning since the kernel was never informed of the wipe.wipefs(8)
so that the kernel is informed and ZED will re-partition the device.Sponsored-By: OpenDrives Inc.
Sponsored-By: Klara Inc.
How Has This Been Tested?
ZTS
functional/fault
testsAudit ZED logging from the tests to confirm that ZED auto-replace was functioning as expected.
Types of changes
Checklist:
Signed-off-by
.