]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: fix standby replay in multimds setup
authorYan, Zheng <zyan@redhat.com>
Thu, 19 Apr 2018 02:15:23 +0000 (10:15 +0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 18 Jun 2018 19:19:31 +0000 (12:19 -0700)
The code should break loops for two level. otherwise, in multimds setup,
a standby mds may get assigned to standby replay multiple times. This
bug may cause monitor to crash.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Fixes: http://tracker.ceph.com/issues/23658
(cherry picked from commit 8d40e21de0a115cc92e4da04ec61a34ac59145e1)

src/mon/MDSMonitor.cc

index 68f1e7ccc3ecbfb12875a8b97f3cfeb340e9bf54..6db751d50b6bdca0450587ec2c42944eecc0365e 100644 (file)
@@ -2226,6 +2226,7 @@ bool MDSMonitor::maybe_promote_standby(std::shared_ptr<Filesystem> &fs)
 
       // check everyone
       for (const auto &p : pending.filesystems) {
+       bool assigned = false;
         const auto &fs = p.second;
         const MDSMap &mds_map = fs->mds_map;
         for (const auto &mds_i : mds_map.mds_info) {
@@ -2237,12 +2238,15 @@ bool MDSMonitor::maybe_promote_standby(std::shared_ptr<Filesystem> &fs)
             }
 
             if (try_standby_replay(info, *fs, cand_info)) {
-              do_propose = true;
+             assigned = true;
               break;
             }
-            continue;
           }
         }
+       if (assigned) {
+         do_propose = true;
+         break;
+       }
       }
     }
   }