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)
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) {