]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: try to flush the mdlog when requesting the rdlock 42071/head
authorXiubo Li <xiubli@redhat.com>
Tue, 15 Jun 2021 03:25:31 +0000 (11:25 +0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 28 Jun 2021 19:51:51 +0000 (12:51 -0700)
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 <xiubli@redhat.com>
(cherry picked from commit 63f7a165ec6bbf9cb1bded29f8bc5c017c01c768)

src/mds/Locker.cc

index a2fbe76625ab2435d2f2ae232f30bbcfda4dcda4..cab6051b2f4ffab32a2da376b3178141e902c9f3 100644 (file)
@@ -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) {