Skip to content

Commit eac482b

Browse files
committed
mds/quiesce: don't take mirrored cap-related locks on the replica
For every mirrored lock, the auth will message the replica to ensure the replicated lock state. When we take x/rdlock on the auth, it will ensure the LOCK_LOCK state on the replica, which has the file caps we want for quiesce: CACHE and BUFFER. It should be sufficient to only hold the quiesce local lock on the replica side. Signed-off-by: Leonid Usov <[email protected]>
1 parent 8ac9842 commit eac482b

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

src/mds/MDCache.cc

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13623,30 +13623,36 @@ void MDCache::dispatch_quiesce_inode(const MDRequestRef& mdr)
1362313623

1362413624
lov.add_xlock(&in->quiescelock); /* !! */
1362513625

13626-
if (splitauth) {
13627-
// xlock the file to let the Fb clients stay with buffered writes.
13628-
// While this will unnecesarily revoke rd caps, it's not as
13629-
// big of an overhead compared to having the Fb clients flush
13630-
// their buffers, which evidently can lead to the quiesce timeout
13631-
// We'll drop the lock after all clients conform to this request
13632-
// so the file will be still readable during the quiesce after
13633-
// the interested clients receive their Fr back
13634-
//
13635-
// NB: this will also wrlock the versionlock
13636-
lov.add_xlock(&in->filelock);
13626+
if (in->is_auth()) {
13627+
if (splitauth) {
13628+
// xlock the file to let the Fb clients stay with buffered writes.
13629+
// While this will unnecesarily revoke rd caps, it's not as
13630+
// big of an overhead compared to having the Fb clients flush
13631+
// their buffers, which evidently can lead to the quiesce timeout
13632+
// We'll drop the lock after all clients conform to this request
13633+
// so the file will be still readable during the quiesce after
13634+
// the interested clients receive their Fr back
13635+
//
13636+
// NB: this will also wrlock the versionlock
13637+
lov.add_xlock(&in->filelock);
13638+
} else {
13639+
// if splitauth == false then we won't drop the lock after acquisition (see below)
13640+
// we can't afford keeping it as xlock for a long time, so we'll have to deal
13641+
// with the potential quiesce timeout on high-load systems.
13642+
// The reason we're OK with this is that splitauth is enabled by default,
13643+
// and really should not be ever disabled outside of the test setups
13644+
// TODO: consider removing the `splitauth` config option completely.
13645+
lov.add_rdlock(&in->filelock);
13646+
}
13647+
// The rest of caps-related locks - rdlock to revoke write caps
13648+
lov.add_rdlock(&in->authlock);
13649+
lov.add_rdlock(&in->linklock);
13650+
lov.add_rdlock(&in->xattrlock);
1363713651
} else {
13638-
// if splitauth == false then we won't drop the lock after acquisition (see below)
13639-
// we can't afford keeping it as xlock for a long time, so we'll have to deal
13640-
// with the potential quiesce timeout on high-load systems.
13641-
// The reason we're OK with this is that splitauth is enabled by default,
13642-
// and really should not be ever disabled outside of the test setups
13643-
// TODO: consider removing the `splitauth` config option completely.
13644-
lov.add_rdlock(&in->filelock);
13645-
}
13646-
// The rest of caps-related locks - rdlock to revoke write caps
13647-
lov.add_rdlock(&in->authlock);
13648-
lov.add_rdlock(&in->linklock);
13649-
lov.add_rdlock(&in->xattrlock);
13652+
// replica will follow suite and move to LOCK_LOCK state
13653+
// as a result of the auth taking the above locks.
13654+
}
13655+
1365013656
if (!mds->locker->acquire_locks(mdr, lov, nullptr, {in}, false, true)) {
1365113657
return;
1365213658
}
@@ -13664,7 +13670,7 @@ void MDCache::dispatch_quiesce_inode(const MDRequestRef& mdr)
1366413670
return;
1366513671
}
1366613672

13667-
if (splitauth) {
13673+
if (in->is_auth() && splitauth) {
1366813674
/* Once we have the queiscelock, we no longer need these locks. However,
1366913675
* if splitauth==false, the replicas do not try quiescing so we must keep
1367013676
* them locked.

0 commit comments

Comments
 (0)