-
Notifications
You must be signed in to change notification settings - Fork 1.8k
More aggressively assert that db_mtx protects db.db_data #17209
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
Open
asomers
wants to merge
5
commits into
openzfs:master
Choose a base branch
from
asomers:assert-db-mtx
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+26
−18
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 openzfs#17118 Sponsored by: ConnectWise Signed-off-by: Alan Somers <asomers@gmail.com>
@pcd1193182 could you review, please? |
From one of the test runs:
it would seem that |
It looks like that's a Linux-only panic, which is why I didn't see it . I'll investigate. |
It's an error that nothing locks the mutex here. I'll fix it in my next PR. Signed-off-by: Alan Somers <asomers@gmail.com>
amotin
reviewed
Apr 30, 2025
Copy data into the newly allocated buffer before assigning it to the db. That way, there will be no need to take db->db_rwlock. Signed-off-by: Alan Somers <asomers@gmail.com>
In the case of an indirect hole, initialize the newly allocated buffer before assigning it to the dmu_buf_impl_t. Signed-off-by: Alan Somers <asomers@gmail.com>
@amotin I applied your suggestions. |
amotin
reviewed
May 1, 2025
Signed-off-by: Alan Somers <asomers@gmail.com>
amotin
approved these changes
May 1, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 asomers@gmail.com
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
.