More aggressively assert that db_mtx protects db.db_data #17209
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.
db.db_mtx must be held any time that db.db_data is accessed. All of these functions do have the lock held by a parent; add assertions to ensure that it stays that way.
Also, refactor dbuf_read_bonus to make it obvious why db_rwlock isn't required.
See #17118
Sponsored by: ConnectWise
Signed-off-by: Alan Somers [email protected]
Motivation and Context
Bug #16626 probably results from improper locking around db.db_data. Any time that variable is accessed, db_mtx must be held.
Description
As a first step to fixing that bug, add some more assertions in places that already do have the lock, but don't currently assert that they do. This will make the problem more clear, and prevent regressions in those functions.
How Has This Been Tested?
I ran the ZFS test suite in FreeBSD 15.0-CURRENT.
Types of changes
Checklist:
Signed-off-by
.