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

pacific: mds: drop locks and retry when lock set changes #53243

Merged
merged 1 commit into from Sep 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/mds/Server.cc
Expand Up @@ -4071,6 +4071,24 @@ void Server::handle_client_getattr(MDRequestRef& mdr, bool is_lookup)
} else if (ref->filelock.is_stable() ||
ref->filelock.get_num_wrlocks() > 0 ||
!ref->filelock.can_read(mdr->get_client())) {
/* Since we're taking advantage of an optimization here:
*
* We cannot suddenly, due to a changing condition, add this filelock as
* it can cause lock-order deadlocks. In this case, that condition is the
* lock state changes between request retries. If that happens, we need
* to check if we've acquired the other locks in this vector. If we have,
* then we need to drop those locks and retry.
*/
if (mdr->is_rdlocked(&ref->linklock) ||
mdr->is_rdlocked(&ref->authlock) ||
mdr->is_rdlocked(&ref->xattrlock)) {
/* start over */
dout(20) << " dropping locks and restarting request because filelock state change" << dendl;
mds->locker->drop_locks(mdr.get());
mdr->drop_local_auth_pins();
mds->queue_waiter(new C_MDS_RetryRequest(mdcache, mdr));
return;
}
lov.add_rdlock(&ref->filelock);
mdr->locking_state &= ~MutationImpl::ALL_LOCKED;
}
Expand Down