From: Xiubo Li Date: Tue, 15 Jun 2021 03:25:31 +0000 (+0800) Subject: mds: try to flush the mdlog when requesting the rdlock X-Git-Tag: v16.2.5~16^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F42071%2Fhead;p=ceph.git mds: try to flush the mdlog when requesting the rdlock After client requests' early_reply() the mdlog won't be flushed immediately, but it will hold the write lock. So if the client sends another request to a different MDS daemon, which then needs to request read lock, then it maybe stuck at most for 5 seconds. Let's try to flush the mdlog which might release the write locks after mdlog is successfully flushed. Fixes: https://tracker.ceph.com/issues/51069 Signed-off-by: Xiubo Li (cherry picked from commit 63f7a165ec6bbf9cb1bded29f8bc5c017c01c768) --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index a2fbe76625ab..cab6051b2f4f 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -4624,6 +4624,17 @@ bool Locker::simple_sync(SimpleLock *lock, bool *need_issue) gather++; if (lock->is_cached()) invalidate_lock_caches(lock); + + // After a client request is early replied the mdlog won't be flushed + // immediately, but before safe replied the request will hold the write + // locks. So if the client sends another request to a different MDS + // daemon, which then needs to request read lock from current MDS daemon, + // then that daemon maybe stuck at most for 5 seconds. Which will lead + // the client stuck at most 5 seconds. + // + // Let's try to flush the mdlog when the write lock is held, which will + // release the write locks after mdlog is successfully flushed. + mds->mdlog->flush(); } if (lock->get_parent()->is_replicated() && old_state == LOCK_MIX) {