Skip to content
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

Fix spa_nonallocating_dspace for special vdevs #17157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amotin
Copy link
Member

@amotin amotin commented Mar 19, 2025

Since spa_dspace accounts only normal allocation class space, spa_nonallocating_dspace should do the same. Otherwise we may get negative overflow or respective assertion in spa_update_dspace() if removed special/dedup vdev is bigger than all normal class space.

How Has This Been Tested?

Originally I spotted it while reviewing ztest CI failures. After that I reproduced it manually by trying to remove from a pool special vdev that is bigger than normal vdev. Applying the patch fixed the manual test.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

@amotin amotin added the Status: Code Review Needed Ready for review and testing label Mar 19, 2025
@jumbi77
Copy link
Contributor

jumbi77 commented Mar 19, 2025

Well spotted. Is a dedicated test case useful here?

@amotin
Copy link
Member Author

amotin commented Mar 19, 2025

@jumbi77 I haven't looked what device removal tests do we actually have in ZTS now, but if you wish to review them and add a case to something existing -- be my guest.

Since spa_dspace accounts only normal allocation class space,
spa_nonallocating_dspace should do the same.  Otherwise we may get
negative overflow or respective assertion spa_update_dspace() if
removed special/dedup vdev is bigger than all normal class space.

Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
@amotin amotin force-pushed the nonallocating_dspace branch from 261ae83 to 427e8bc Compare March 20, 2025 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Code Review Needed Ready for review and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants