]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: cleanup MDCache::open_snaprealms() 16779/head
authorYan, Zheng <zyan@redhat.com>
Thu, 29 Mar 2018 03:06:13 +0000 (11:06 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 29 Mar 2018 03:10:20 +0000 (11:10 +0800)
don't retry if all snaprealms' parent are open

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

index e989fc7412c2d5e48fd6fe562418687cccee8016..8c1a9798402b0e669bc658bb3e39ba7e2fa8d8cf 100644 (file)
@@ -5871,41 +5871,48 @@ void MDCache::open_snaprealms()
     }
   }
 
-  notify_global_snaprealm_update(CEPH_SNAP_OP_UPDATE);
-
   if (gather.has_subs()) {
-    // for multimds, must succeed the first time
-    assert(recovery_set.empty());
+    if (gather.num_subs_remaining() == 0) {
+      // cleanup gather
+      gather.set_finisher(new C_MDSInternalNoop);
+      gather.activate();
+    } else {
+      // for multimds, must succeed the first time
+      assert(recovery_set.empty());
 
-    dout(10) << "open_snaprealms - waiting for "
-            << gather.num_subs_remaining() << dendl;
-    gather.set_finisher(new C_MDC_OpenSnapRealms(this));
-    gather.activate();
-  } else {
-    if (!reconnected_snaprealms.empty()) {
-      dout(5) << "open_snaprealms has unconnected snaprealm:" << dendl;
-      for (auto& p : reconnected_snaprealms) {
-       stringstream warn_str;
-       warn_str << " " << p.first << " {";
-       bool first = true;
-       for (auto& q : p.second) {
-         if (!first)
-           warn_str << ", ";
-         warn_str << "client." << q.first << "/" << q.second;
-       }
-       warn_str << "}";
-       dout(5) << warn_str.str() << dendl;
-      }
+      dout(10) << "open_snaprealms - waiting for "
+              << gather.num_subs_remaining() << dendl;
+      gather.set_finisher(new C_MDC_OpenSnapRealms(this));
+      gather.activate();
+      return;
     }
-    assert(rejoin_waiters.empty());
-    assert(rejoin_pending_snaprealms.empty());
-    dout(10) << "open_snaprealms - all open" << dendl;
-    do_delayed_cap_imports();
-
-    assert(rejoin_done);
-    rejoin_done.release()->complete(0);
-    reconnected_caps.clear();
   }
+
+  notify_global_snaprealm_update(CEPH_SNAP_OP_UPDATE);
+
+  if (!reconnected_snaprealms.empty()) {
+    dout(5) << "open_snaprealms has unconnected snaprealm:" << dendl;
+    for (auto& p : reconnected_snaprealms) {
+      stringstream warn_str;
+      warn_str << " " << p.first << " {";
+      bool first = true;
+      for (auto& q : p.second) {
+        if (!first)
+          warn_str << ", ";
+        warn_str << "client." << q.first << "/" << q.second;
+      }
+      warn_str << "}";
+      dout(5) << warn_str.str() << dendl;
+    }
+  }
+  assert(rejoin_waiters.empty());
+  assert(rejoin_pending_snaprealms.empty());
+  dout(10) << "open_snaprealms - all open" << dendl;
+  do_delayed_cap_imports();
+
+  assert(rejoin_done);
+  rejoin_done.release()->complete(0);
+  reconnected_caps.clear();
 }
 
 bool MDCache::open_undef_inodes_dirfrags()