]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: flush dirty dirfrags that weren't logged when deactivating mds 25095/head
authorYan, Zheng <zyan@redhat.com>
Wed, 17 Oct 2018 09:22:47 +0000 (17:22 +0800)
committerJonathan Brielmaier <jbrielmaier@suse.de>
Wed, 14 Nov 2018 15:59:13 +0000 (16:59 +0100)
CDir::log_mark_dirty() may mark dirfrag dirty, without journal event.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 68b6073af92595da92c0032e814a2bb3d3cba5cd)
Signed-off-by: Jonathan Brielmaier <jbrielmaier@suse.de>
src/mds/MDCache.cc

index 94fbd5b6d8c288a6739da62ad625cc8d5a785581..f09f807d624386e8eb79551871f83f09060e9d5e 100644 (file)
@@ -7800,11 +7800,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) {