vdev_draid_min_asize() ignores reserved space #12221
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
vdev_draid_min_asize() returns the minimum size of a child vdev. This
is used when determining if a disk is big enough to replace a child.
It's also used by zdb to determine how big of a child to make to test
replacement.
`vdev_draid_min_asize() says that the child’s asize has to be at least 1/Nth of
the entire draid’s asize, which is the same logic as raidz. However, this
contradicts the code in vdev_draid_open(), which calculates the draid’s asize
based on a reduced child size:
An additional 32MB of scratch space is reserved at the end of each child for
use by the dRAID expansion feature
So the problem is that you can replace a draid disk with one that’s
vdev_draid_min_asize(), but it actually needs to be larger to accomodate the
additional 32MB. The replacement is allowed and everything works at first
(since the reserved space is at the end, and we don’t try to use it yet), but
when you try to close and reopen the pool, vdev_draid_open() calculates a
smaller asize for the draid, because of the smaller leaf, which is not allowed.
I think the confusion is that vdev_draid_min_asize() is correctly returning the
amount of required allocatable space in a leaf, but the actual size of the
leaf needs to be at least 32MB more than that. ztest_vdev_attach_detach()
assumes that it can attach that size of device, and it actually can (the
kernel/libzpool accepts it), but it then later causes zdb to not be able to open the pool.
Description
This commit changes vdev_draid_min_asize() to return the required size of the
leaf, not the size that draid will make available to the metaslab allocator.
Closes #11459
How Has This Been Tested?
zloop
Types of changes
Checklist:
Signed-off-by
.