Repository navigation
mds: getattr just waits the xlock to be released by the previous client #56602
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another bug I think. This won't handle the case where we're skipping e.g. a rdlock when the client is issued an exclusive cap, like
Ax. Consider:client 1: issued
pAxclient 2:
getattr pAsLsXsFsissuedpLxXxclient 3:
getattr pAsLsXsFsissuedpclient 2 will skip acquiring the linklock/xattrlock because it's issued
LxXx. It will block on recall ofAxfrom client 1.Client 2's
getattrcannot be a batch head for client 3's `getattr.This all exposes a problem I believe exists with where we're constructing the batch head: this should be constructed only after this
acquire_locksfails:ceph/src/mds/Server.cc
Lines 4217 to 4218 in 2c16096
Before that point, record whether we've skipped any locks due to issued caps or (for this particular bug) the lock is already xlocked by the client. The latter cannot be easily checked without looking at the inode's lock because the Locker state machine hides why a rdlock succeeds (in this case, the client has an xlock already).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@batrick Correct me if I am wrong here.
From
mds/lock.cI can see that only the loner client could get thexcaps. Could you point me out in which case could we see thexin different locks will be issued to different clients at the same time ?Different locks could have different loners at the same time ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be right; I'm not sure. In principle I don't see why it wouldn't be allowed but the state diagram suggests it is not.
It doesn't look like it but it's worth checking.
I think the batch leader construction should still be moved however. And that "detail" of the loner client shouldn't be relied on for the checks in any case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't remember I ever saw this case, just now I checked some debug logs, such as the debug logs from:
ceph-post-file: fb9a96f9-5f6d-46b4-b1fa-8580928b2241I didn't find any case will do this. And also by going through the mds code, only when a longer is successfully set will the
EXCLlocker state could be set. And all the lockers in a CInode will be set to the same single longer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then perhaps the better check is: "is this client the loner for the CInode? In that case, do not make it a batch head".
Let's move the batch code below this call to
acquire_lockson failure:ceph/src/mds/Server.cc
Lines 4217 to 4218 in 2c16096
If we fail to acquire the locks, then make it the batch head if one does not exist. If a batch head does exist already, then drop locks and add it to the batch queue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked the code carefully again, if my understanding is correct this won't work well as expected ?
For example, if the first
lookuprequest just wants to acquire therdlockforlinklockand it succeeds, and then later the secondlookuprequest comes and also just wants to therdlockfor thelinklock. If both these two requests succeeds there won't be any chance to batch them. Actually we should batch them, right ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no further waits after that
acquire_locksso I don't think so?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think you should right here. Let me check it more.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@batrick If we will move the batch code after
acquire_locks, we also should adjust theacquire_locksand other callers to make sure that they won't add the current request to any waiter, which will retry the request later, and then try to batch this request.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that's right. Let's leave it this way then.