]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: make stopping mds export strays and subtree at the same time 21346/head
authorYan, Zheng <zyan@redhat.com>
Mon, 2 Apr 2018 03:26:22 +0000 (11:26 +0800)
committerPrashant D <pdhange@redhat.com>
Wed, 11 Apr 2018 09:08:02 +0000 (05:08 -0400)
Stopping mds also handle client requests now. Client requests may
continue to create strays dentries. So mds should start to export
auth subtrees immediately after its state transits to 'stopping'

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 436a56a2906fb3a3925cbb081342b4544aef5022)

src/mds/MDCache.cc

index f58ae770d3d776171c42c8284958f8ebac8220bc..5ae6f347159aa3c7d6f199b1daad6af3c2271862 100644 (file)
@@ -7510,20 +7510,7 @@ bool MDCache::shutdown_pass()
   }
 
   // empty stray dir
-  if (!shutdown_export_strays()) {
-    dout(7) << "waiting for strays to migrate" << dendl;
-    return false;
-  }
-  
-  // drop our reference to our stray dir inode
-  for (int i = 0; i < NUM_STRAY; ++i) {
-    if (strays[i] &&
-       strays[i]->state_test(CInode::STATE_STRAYPINNED)) {
-      strays[i]->state_clear(CInode::STATE_STRAYPINNED);
-      strays[i]->put(CInode::PIN_STRAY);
-      strays[i]->put_stickydirs();
-    }
-  }
+  bool strays_all_exported = shutdown_export_strays();
 
   // trim cache
   trim(UINT64_MAX);
@@ -7562,6 +7549,11 @@ bool MDCache::shutdown_pass()
     }
   }
 
+  if (!strays_all_exported) {
+    dout(7) << "waiting for strays to migrate" << dendl;
+    return false;
+  }
+
   if (num_auth_subtree > 0) {
     dout(7) << "still have " << num_auth_subtree << " auth subtrees" << dendl;
     show_subtrees();
@@ -7575,6 +7567,16 @@ bool MDCache::shutdown_pass()
     return false;
   }
 
+  // drop our reference to our stray dir inode
+  for (int i = 0; i < NUM_STRAY; ++i) {
+    if (strays[i] &&
+       strays[i]->state_test(CInode::STATE_STRAYPINNED)) {
+      strays[i]->state_clear(CInode::STATE_STRAYPINNED);
+      strays[i]->put(CInode::PIN_STRAY);
+      strays[i]->put_stickydirs();
+    }
+  }
+
   CDir *mydir = myin ? myin->get_dirfrag(frag_t()) : NULL;
   if (mydir && !mydir->is_subtree_root())
     mydir = NULL;
@@ -7677,9 +7679,9 @@ bool MDCache::shutdown_export_strays()
 
   list<CDir*> dfs;
   for (int i = 0; i < NUM_STRAY; ++i) {
-    if (!strays[i]) {
+    if (!strays[i] ||
+       !strays[i]->state_test(CInode::STATE_STRAYPINNED))
       continue;
-    }
     strays[i]->get_dirfrags(dfs);
   }