]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: cleanup ambiguous slave update when master mds fails
authorYan, Zheng <zyan@redhat.com>
Mon, 6 Feb 2017 09:15:40 +0000 (17:15 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 20 Feb 2017 08:12:36 +0000 (16:12 +0800)
When auth mds of rename source dentry fails, slave updates in witness
mds become ambiguous. Witnesses need to ask the master if they should
rollback the updates. This type of rollback is special, corresponding
MDRequest struct need to be preserved after rollback. If the master
mds also fails, slave updates in witness mds are no longer special.
Corresponding MDRequest struct need to be cleanup after rollback.

see commit e62e48bb for more information.

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

index 3884415a7d39077e6e8e7581329a145ad5db5ace..c5936dd65d897e5b2a410f5aa47596c50c8a89b9 100644 (file)
@@ -2890,6 +2890,9 @@ void MDCache::handle_mds_failure(mds_rank_t who)
     if (mdr->slave_to_mds == who) {
       if (mdr->slave_did_prepare()) {
        dout(10) << " slave request " << *mdr << " uncommitted, will resolve shortly" << dendl;
+       if (is_ambiguous_slave_update(p->first, mdr->slave_to_mds))
+         remove_ambiguous_slave_update(p->first, mdr->slave_to_mds);
+
        if (!mdr->more()->waiting_on_slave.empty()) {
          assert(mdr->more()->srcdn_auth_mds == mds->get_nodeid());
          // will rollback, no need to wait
index ab131c79b921ec557314ad3c2a82ba56c5e42a02..fc3b5fcc557bba1c1a25e93224341dc4e0cc5926 100644 (file)
@@ -452,17 +452,19 @@ public:
   void remove_inode_recursive(CInode *in);
 
   bool is_ambiguous_slave_update(metareqid_t reqid, mds_rank_t master) {
-    return ambiguous_slave_updates.count(master) &&
-          ambiguous_slave_updates[master].count(reqid);
+    auto p = ambiguous_slave_updates.find(master);
+    return p != ambiguous_slave_updates.end() && p->second.count(reqid);
   }
   void add_ambiguous_slave_update(metareqid_t reqid, mds_rank_t master) {
     ambiguous_slave_updates[master].insert(reqid);
   }
   void remove_ambiguous_slave_update(metareqid_t reqid, mds_rank_t master) {
-    assert(ambiguous_slave_updates[master].count(reqid));
-    ambiguous_slave_updates[master].erase(reqid);
-    if (ambiguous_slave_updates[master].empty())
-      ambiguous_slave_updates.erase(master);
+    auto p = ambiguous_slave_updates.find(master);
+    auto q = p->second.find(reqid);
+    assert(q != p->second.end());
+    p->second.erase(q);
+    if (p->second.empty())
+      ambiguous_slave_updates.erase(p);
   }
 
   void add_rollback(metareqid_t reqid, mds_rank_t master) {