]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: trim log during shutdown to clean metadata 21719/head
authorPatrick Donnelly <pdonnell@redhat.com>
Sun, 29 Apr 2018 00:17:53 +0000 (17:17 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 30 Apr 2018 16:58:10 +0000 (09:58 -0700)
Otherwise the trimming won't advance so that the remaining inodes are marked
clean.

Fixes: http://tracker.ceph.com/issues/23923
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/MDCache.cc

index 6803eeadee2ff23714bf4ac173f0880091f8cb2a..62a4b8f7ce5ab51d1064ffcad21044ac319b76ca 100644 (file)
@@ -7676,7 +7676,7 @@ bool MDCache::shutdown_pass()
   trim(UINT64_MAX);
   dout(5) << "lru size now " << lru.lru_get_size() << "/" << bottom_lru.lru_get_size() << dendl;
 
-  // SUBTREES
+  // Export all subtrees to another active (usually rank 0) if not rank 0
   int num_auth_subtree = 0;
   if (!subtrees.empty() &&
       mds->get_nodeid() != 0 && 
@@ -7715,6 +7715,7 @@ bool MDCache::shutdown_pass()
   }
 
   if (num_auth_subtree > 0) {
+    assert(mds->get_nodeid() > 0);
     dout(7) << "still have " << num_auth_subtree << " auth subtrees" << dendl;
     show_subtrees();
     return false;
@@ -7727,6 +7728,15 @@ bool MDCache::shutdown_pass()
     return false;
   }
 
+  // Fully trim the log so that all objects in cache are clean and may be
+  // trimmed by a future MDCache::trim. Note that MDSRank::tick does not
+  // trim the log such that the cache eventually becomes clean.
+  mds->mdlog->trim(0);
+  if (mds->mdlog->get_num_segments() > 1) {
+    dout(7) << "still >1 segments, waiting for log to trim" << dendl;
+    return false;
+  }
+
   // drop our reference to our stray dir inode
   for (int i = 0; i < NUM_STRAY; ++i) {
     if (strays[i] &&
@@ -7754,13 +7764,6 @@ bool MDCache::shutdown_pass()
   assert(!migrator->is_exporting());
   assert(!migrator->is_importing());
 
-  // flush what we can from the log
-  mds->mdlog->trim(0);
-  if (mds->mdlog->get_num_segments() > 1) {
-    dout(7) << "still >1 segments, waiting for log to trim" << dendl;
-    return false;
-  }
-
   if ((myin && myin->is_auth_pinned()) ||
       (mydir && mydir->is_auth_pinned())) {
     dout(7) << "still have auth pinned objects" << dendl;