]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: trigger to flush the mdlog in handle_find_ino() 46497/head
authorXiubo Li <xiubli@redhat.com>
Tue, 19 Apr 2022 06:21:49 +0000 (14:21 +0800)
committerXiubo Li <xiubli@redhat.com>
Thu, 2 Jun 2022 04:44:57 +0000 (12:44 +0800)
If the the CInode was just created by using openc in current
auth MDS, but the client just sends a getattr request to another
replica MDS. Then here it will make a path of '#INODE-NUMBER'
only because the CInode hasn't been linked yet, and the replica
MDS will keep retrying until the auth MDS flushes the mdlog and
the C_MDS_openc_finish and link_primary_inode are called at most
5 seconds later.

Fixes: https://tracker.ceph.com/issues/55240
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 5d6dd5d1acf94eade4a2c0f48777c95473d454ae)

src/mds/MDCache.cc

index a87e4e33208b59401e1d38590458850b66932025..8696c6d929aa8e98134b959c59132be417a3233a 100644 (file)
@@ -9326,6 +9326,19 @@ void MDCache::handle_find_ino(const cref_t<MMDSFindIno> &m)
   if (in) {
     in->make_path(r->path);
     dout(10) << " have " << r->path << " " << *in << dendl;
+
+    /*
+     * If the the CInode was just created by using openc in current
+     * auth MDS, but the client just sends a getattr request to another
+     * replica MDS. Then here it will make a path of '#INODE-NUMBER'
+     * only because the CInode hasn't been linked yet, and the replica
+     * MDS will keep retrying until the auth MDS flushes the mdlog and
+     * the C_MDS_openc_finish and link_primary_inode are called at most
+     * 5 seconds later.
+     */
+    if (!in->get_parent_dn() && in->is_auth()) {
+      mds->mdlog->flush();
+    }
   }
   mds->send_message_mds(r, mds_rank_t(m->get_source().num()));
 }