]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: flush dirty dirfrags that weren't logged when deactivating mds 25826/head
authorYan, Zheng <zyan@redhat.com>
Wed, 17 Oct 2018 09:22:47 +0000 (17:22 +0800)
committerVicente Cheng <freeze.bilsted@gmail.com>
Tue, 8 Jan 2019 01:53:45 +0000 (09:53 +0800)
CDir::log_mark_dirty() may mark dirfrag dirty, without journal event.

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

src/mds/MDCache.cc

index 48e237030f366be1563b315f1a4272d8f4953e56..14519a16e29a15e8f50cc98513bbcf776f0b9d74 100644 (file)
@@ -7642,11 +7642,14 @@ bool MDCache::shutdown_pass()
   // 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.
-  if (mds->mdlog->get_num_segments() > 0 &&
-      mds->mdlog->get_current_segment()->num_events > 1) {
-    // current segment contains events other than subtreemap
-    mds->mdlog->start_new_segment();
-    mds->mdlog->flush();
+  if (mds->mdlog->get_num_segments() > 0) {
+    auto ls = mds->mdlog->get_current_segment();
+    if (ls->num_events > 1 || !ls->dirty_dirfrags.empty()) {
+      // Current segment contains events other than subtreemap or
+      // there are dirty dirfrags (see CDir::log_mark_dirty())
+      mds->mdlog->start_new_segment();
+      mds->mdlog->flush();
+    }
   }
   mds->mdlog->trim_all();
   if (mds->mdlog->get_num_segments() > 1) {