Add additional sanity check when resuming a pool #6212
Closed
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.
Description
A pool may only be resumed when the txg in the "best" uberblock
found on-disk matches the in-core last synced txg. This is done
to verify that the pool was not modified by another node or process
while it was suspended. If this were to happen the result would
be a corrupted pool.
Since a suspended pool may no longer always be resumable it was
necessary to extend the 'zpool export -F` command to allow a
suspended pool to be exported. This was accomplished by leveraging
the existing spa freeze functionality. During export if '-F' is
given and the pool is suspended the pool will be frozen at the last
synced txg and all in-core dirty data will be discarded. This
allows for the pool to be safely exported without having to reboot
the system.
In order to test this functionality the broken 'ztest -E' option,
which allows for ztest to use an existing pool, was fixed. The
code needed for this was copied over from zdb. ztest is used to
modify the test pool from user space while the kernel has the pool
imported and suspended.
This commit partially addresses issues #4003, #2023, #2878, #3256
by allowing a suspended pool to be exported, 'zpool export -F'.
There may still be cases where a reference on the pool, such as
a filesystem which cannot be unmounted, will prevent the pool
from being exported.
Motivation and Context
Related to multi-modifier protection, PR #6073.
How Has This Been Tested?
Added test case
zpool_clear-resume.ksh
.Types of changes
Checklist:
Signed-off-by
.