-
Notifications
You must be signed in to change notification settings - Fork 2k
zhack: add "mmp reclaim" to recover a pool stranded by MMP #18892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mkhllr
wants to merge
3
commits into
openzfs:master
Choose a base branch
from
mkhllr:zhack-mmp-reclaim
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -196,6 +196,22 @@ uint_t zfs_multihost_import_intervals = MMP_DEFAULT_IMPORT_INTERVALS; | |
| */ | ||
| uint_t zfs_multihost_fail_intervals = MMP_DEFAULT_FAIL_INTERVALS; | ||
|
|
||
| #ifndef _KERNEL | ||
| /* | ||
| * Manual recovery only, set by zhack. Drops the mirror legs this host | ||
| * cannot open from the uberblock claim's required write count, so a pool | ||
| * whose config still expects legs that died with a peer host can be | ||
| * imported by hand. Every leg which can be opened is still required. | ||
| * | ||
| * This is deliberately absent from the kernel module. The write, the wait | ||
| * and the re-read are untouched, so a competing importer which shares any | ||
| * visibility with us is still caught; a live peer whose legs are all | ||
| * invisible from here is not, and cannot be by any write-and-read scheme. | ||
| * That residual is why this is a manual operation guarded by fencing. | ||
| */ | ||
| boolean_t mmp_claim_relaxed = B_FALSE; | ||
| #endif | ||
|
|
||
| static const void *const mmp_tag = "mmp_write_uberblock"; | ||
| static __attribute__((noreturn)) void mmp_thread(void *arg); | ||
|
|
||
|
|
@@ -600,6 +616,19 @@ mmp_claim_uberblock_sync(zio_t *zio, uint64_t *good_writes, | |
| for (uint64_t l = 0; l < cvd->vdev_children; | ||
| l++) { | ||
| vdev_t *lvd = cvd->vdev_child[l]; | ||
| #ifndef _KERNEL | ||
| /* | ||
| * Manual recovery forgives the legs | ||
| * this host could not open, and marks | ||
| * that same set offline before it | ||
| * exports, so the relaxed claim | ||
| * accepts nothing the later ordinary | ||
| * imports would not. | ||
| */ | ||
| if (mmp_claim_relaxed && | ||
| lvd->vdev_not_present) | ||
| continue; | ||
| #endif | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While you're here, can you also fix up the "for mirror 2 writes" portion of this comment at the end of |
||
| if (!lvd->vdev_offline && | ||
| !lvd->vdev_faulted && | ||
| !lvd->vdev_removed) | ||
|
|
@@ -669,7 +698,8 @@ mmp_claim_uberblock(spa_t *spa, vdev_t *vd, uberblock_t *ub) | |
| /* | ||
| * To guarantee visibility from a remote host we require a minimum | ||
| * number of good writes. For raidz/draid vdevs parity+1 writes, for | ||
| * mirrors 2 writes, and for singletons 1 write. | ||
| * mirrors one write per leg the config expects present, and for | ||
| * singletons 1 write. | ||
| */ | ||
| if (req_writes == 0 || good_writes < req_writes) | ||
| return (SET_ERROR(EIO)); | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave some more breadcrumbs to make it easier for anyone who encounters this corner case to find the documentation. Plumbing the error all the way back to
do_import()inzpool_main.cwould be awkward. But we could updatespa_activity_check_claim()to return EIO whenmmp_claim_uberblock()fails due to insufficient good writes. Then we can log a more useful error message to the console inspa_ld_activity_result()before it returns the expected EREMOTEIO, similar to the existingENXIOcase.