]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: trim log during shutdown to clean metadata 21899/head
authorPatrick Donnelly <pdonnell@redhat.com>
Sun, 29 Apr 2018 00:17:53 +0000 (17:17 -0700)
committerPrashant D <pdhange@redhat.com>
Thu, 31 May 2018 01:26:10 +0000 (21:26 -0400)
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>
(cherry picked from commit c60ef1b806c4a0c60362193675990447d82a65f4)

src/mds/MDCache.cc

index c10cc2fe4f8d5d786b0e9b7247c03a9a82376d92..bea7496bffc6dc86f9bab79ec1e6ff654f44865f 100644 (file)
@@ -7518,7 +7518,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) {
@@ -7558,6 +7558,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;
@@ -7570,6 +7571,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] &&
@@ -7597,13 +7607,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;