]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: flush dirty dirfrags that weren't logged when deactivating mds 24490/head
authorYan, Zheng <zyan@redhat.com>
Wed, 17 Oct 2018 09:22:47 +0000 (17:22 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 29 Oct 2018 03:42:00 +0000 (11:42 +0800)
CDir::log_mark_dirty() may mark dirfrag dirty, without journal event.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/MDCache.cc

index e9db4bbc550a8087f2e130a9e9d8637802c0f5fb..41c652cfea56bf24963414ea6d8be6549c869a53 100644 (file)
@@ -7675,11 +7675,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) {