]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix hang issue when accessing a file under a lost parent directory 37020/head
authorZhi Zhang <willzzhang@tencent.com>
Fri, 10 Jul 2020 09:03:50 +0000 (17:03 +0800)
committerVicente Cheng <freeze.bilsted@gmail.com>
Mon, 7 Sep 2020 08:30:45 +0000 (08:30 +0000)
When a directory metadata is lost, if we looked up a file under this lost directory,
this request will hang forever.

Fixes: https://tracker.ceph.com/issues/46129
Signed-off-by: Zhi Zhang <zhangz.david@outlook.com>
(cherry picked from commit 778917c426d3c8611c5e5f209840a674c09fef0a)

src/mds/CDir.cc
src/mds/CDir.h

index 67f46df98a51b5e1ce8dad842b8b516b31494721..7d20acc30cf314c6475663f2d842cbc8e67e51a7 100644 (file)
@@ -2046,20 +2046,6 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
   }
 }
 
-void CDir::_go_bad()
-{
-  if (get_version() == 0)
-    set_version(1);
-  state_set(STATE_BADFRAG);
-  // mark complete, !fetching
-  mark_complete();
-  state_clear(STATE_FETCHING);
-  auth_unpin(this);
-
-  // kick waiters
-  finish_waiting(WAIT_COMPLETE, -EIO);
-}
-
 void CDir::go_bad_dentry(snapid_t last, std::string_view dname)
 {
   dout(10) << __func__ << " " << dname << dendl;
@@ -2084,10 +2070,17 @@ void CDir::go_bad(bool complete)
     ceph_abort();  // unreachable, damaged() respawns us
   }
 
-  if (complete)
-    _go_bad();
-  else
-    auth_unpin(this);
+  if (complete) {
+    if (get_version() == 0)
+      set_version(1);
+    
+    state_set(STATE_BADFRAG);
+    mark_complete();
+  }
+
+  state_clear(STATE_FETCHING);
+  auth_unpin(this);
+  finish_waiting(WAIT_COMPLETE, -EIO);
 }
 
 // -----------------------
index aa447a88d0085581837fa10722748188d54661e7..42f1feedfb35a74c07c64247b09e750f719aef18 100644 (file)
@@ -646,11 +646,6 @@ protected:
       const std::set<snapid_t> *snaps,
       bool *force_dirty);
 
-  /**
-   * Mark this fragment as BADFRAG (common part of go_bad and go_bad_dentry)
-   */
-  void _go_bad();
-
   /**
    * Go bad due to a damaged dentry (register with damagetable and go BADFRAG)
    */