]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: keep dentry lock in sync state
authorYan, Zheng <zheng.z.yan@intel.com>
Tue, 12 Nov 2013 08:12:25 +0000 (16:12 +0800)
committerYan, Zheng <zheng.z.yan@intel.com>
Mon, 16 Dec 2013 04:15:23 +0000 (12:15 +0800)
unlike locks of other types, dentry lock in unreadable state can
block path traverse, so it should be in sync state as much as
possible.

This patch make Locker::try_eval() change dentry lock's state to
sync even when the dentry is freezing. Also make migrator check
imported dentries' lock states, change locks' states to sync if
necessary.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
src/mds/Locker.cc
src/mds/Migrator.cc

index 9dcf669d849454835b764f3fe1a35027aa64d75c..1015c8158e80ba1f5c3067447197a0844317257a 100644 (file)
@@ -976,8 +976,8 @@ void Locker::try_eval(SimpleLock *lock, bool *pneed_issue)
     }
   }
 
-  if (p->is_freezing()) {
-    dout(7) << "try_eval " << *lock << " frozen, waiting on " << *p << dendl;
+  if (lock->get_type() != CEPH_LOCK_DN && p->is_freezing()) {
+    dout(7) << "try_eval " << *lock << " freezing, waiting on " << *p << dendl;
     p->add_waiter(MDSCacheObject::WAIT_UNFREEZE, new C_Locker_Eval(this, p, lock->get_type()));
     return;
   }
@@ -3427,8 +3427,13 @@ void Locker::simple_eval(SimpleLock *lock, bool *need_issue)
   assert(lock->get_parent()->is_auth());
   assert(lock->is_stable());
 
-  if (lock->get_parent()->is_freezing_or_frozen())
-    return;
+  if (lock->get_parent()->is_freezing_or_frozen()) {
+    // dentry lock in unreadable state can block path traverse
+    if ((lock->get_type() != CEPH_LOCK_DN ||
+        lock->get_state() == LOCK_SYNC ||
+        lock->get_parent()->is_frozen()))
+      return;
+  }
 
   CInode *in = 0;
   int wanted = 0;
index 7f5ae677afce54178a895990f4ea9087e67a0385..7ca38fef6215919a56917ef3c8495dc958bcbaf7 100644 (file)
@@ -2564,6 +2564,10 @@ int Migrator::decode_import_dir(bufferlist::iterator& blp,
     if (dn->is_replica(mds->get_nodeid()))
       dn->remove_replica(mds->get_nodeid());
 
+    // dentry lock in unreadable state can block path traverse
+    if (dn->lock.get_state() != LOCK_SYNC)
+      mds->locker->try_eval(&dn->lock, NULL);
+
     dout(15) << "decode_import_dir got " << *dn << dendl;
     
     // points to...