Skip to content

Commit 8ac9842

Browse files
committed
mds/quiesce: xlock the file to let clients keep their buffered writes
With the quiesce protocol taking a `rdlock` on the file, it also revokes the `Fb` capability, which the clients can't release until they are done flushing, and that may take up arbitrarily long, evidently, more than 10 minutes. We went for the rdlock to avoid affecting readonly clients, but given the evidence above we should not optimize for those. Ideally, we’d like to have a QUIESCE file lock mode where both rd and buffer are allowed, but as of now it seems like our best available option is to `xlock` the file which will let the writing clients keep their buffers for the duration of the quiesce. We can only afford this change for a `splitauth` config, i.e. where we drop the lock immediately after all `Fw`s are revoked Signed-off-by: Leonid Usov <[email protected]>
1 parent 7714874 commit 8ac9842

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

src/mds/MDCache.cc

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13620,10 +13620,32 @@ void MDCache::dispatch_quiesce_inode(const MDRequestRef& mdr)
1362013620

1362113621
if (!(mdr->locking_state & MutationImpl::ALL_LOCKED)) {
1362213622
MutationImpl::LockOpVec lov;
13623+
13624+
lov.add_xlock(&in->quiescelock); /* !! */
13625+
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);
13637+
} 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
1362313647
lov.add_rdlock(&in->authlock);
13624-
lov.add_rdlock(&in->filelock);
1362513648
lov.add_rdlock(&in->linklock);
13626-
lov.add_xlock(&in->quiescelock); /* !! */
1362713649
lov.add_rdlock(&in->xattrlock);
1362813650
if (!mds->locker->acquire_locks(mdr, lov, nullptr, {in}, false, true)) {
1362913651
return;
@@ -13649,6 +13671,10 @@ void MDCache::dispatch_quiesce_inode(const MDRequestRef& mdr)
1364913671
*/
1365013672
mds->locker->drop_lock(mdr.get(), &in->authlock);
1365113673
mds->locker->drop_lock(mdr.get(), &in->filelock);
13674+
// versionlock will be taken automatically for the file xlock.
13675+
// We don't really need it, but it doesn't make sense to
13676+
// change the Locker logic just for this flow
13677+
mds->locker->drop_lock(mdr.get(), &in->versionlock);
1365213678
mds->locker->drop_lock(mdr.get(), &in->linklock);
1365313679
mds->locker->drop_lock(mdr.get(), &in->xattrlock);
1365413680
}

0 commit comments

Comments
 (0)