]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: handle race of freezing auth pin
authorYan, Zheng <zyan@redhat.com>
Wed, 8 Feb 2017 08:18:51 +0000 (16:18 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 20 Feb 2017 08:12:36 +0000 (16:12 +0800)
Linkage of rename source dentry may change during freezing auth
pin for the rename source inode. So we may freeze auth pin for
the wrong inode.

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

index 1da958316d030f962d325a8f99077553b3693be4..8fc5c61e4f100ecbf6db9aa02aedc407a495dc19 100644 (file)
@@ -330,8 +330,16 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
 
     dout(10) << " must authpin " << *object << dendl;
 
-    if (mdr->is_auth_pinned(object)) 
-      continue;
+    if (mdr->is_auth_pinned(object)) {
+      if (object != (MDSCacheObject*)auth_pin_freeze)
+       continue;
+      if (mdr->more()->is_remote_frozen_authpin) {
+       if (mdr->more()->rename_inode == auth_pin_freeze)
+         continue;
+       // unfreeze auth pin for the wrong inode
+       mustpin_remote[mdr->more()->rename_inode->authority().first].size();
+      }
+    }
     
     if (!object->is_auth()) {
       if (!mdr->locks.empty())
index 2d3584933b8965ccb8d90c470171f89eb895785c..a8e1ec63e783d2e67bedb94de9cde6e5ff2fa180 100644 (file)
@@ -2076,11 +2076,10 @@ void Server::handle_slave_auth_pin(MDRequestRef& mdr)
     MDSCacheObjectInfo info;
     (*p)->set_object_info(info);
     reply->get_authpins().push_back(info);
+    if (*p == (MDSCacheObject*)auth_pin_freeze)
+      auth_pin_freeze->set_object_info(reply->get_authpin_freeze());
   }
 
-  if (auth_pin_freeze)
-    auth_pin_freeze->set_object_info(reply->get_authpin_freeze());
-
   if (wouldblock)
     reply->mark_error_wouldblock();
   if (readonly)
@@ -2115,6 +2114,16 @@ void Server::handle_slave_auth_pin_ack(MDRequestRef& mdr, MMDSSlaveRequest *ack)
     pinned.insert(object);
   }
 
+  // removed frozen auth pin ?
+  if (mdr->more()->is_remote_frozen_authpin &&
+      ack->get_authpin_freeze() == MDSCacheObjectInfo()) {
+    auto p = mdr->remote_auth_pins.find(mdr->more()->rename_inode);
+    assert(p != mdr->remote_auth_pins.end());
+    if (p->second == from) {
+      mdr->more()->is_remote_frozen_authpin = false;
+    }
+  }
+
   // removed auth pins?
   map<MDSCacheObject*, mds_rank_t>::iterator p = mdr->remote_auth_pins.begin();
   while (p != mdr->remote_auth_pins.end()) {