Fix bug caused by rounding in vdev_raidz_asize_to_psize #17490
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.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Motivation and Context
Following @robn 's fix in #17488, I was running some tests with raidz and gang blocks, and ran into a kernel panic. My investigation turned up the following:
When an allocation is happening on a raidz vdev, the number of sectors allocated is rounded up to a multiple of nparity + 1. If this results in the allocation spilling into an extra row, then the corresponding call to vdev_raidz_asize_to_psize will incorrectly assume that parity sectors were allocated for that spilled row, even though no data is stored there.
Description
If we determine that happened, we need to subtract out those extra sectors before performing the rest of the capacity calculation.
How Has This Been Tested?
Manual testing on the system where I found the issue, mathematical analysis with a spreadsheet to verify before/after behavior of the updated formula.
Types of changes
Checklist:
Signed-off-by
.