From: Yan, Zheng Date: Tue, 12 Nov 2013 08:12:25 +0000 (+0800) Subject: mds: keep dentry lock in sync state X-Git-Tag: v0.75~93^2~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b7d78918de346ae63aef17e6c94bf94e54973318;p=ceph.git mds: keep dentry lock in sync state 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 --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 9dcf669d849..1015c8158e8 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -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; diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 7f5ae677afc..7ca38fef621 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -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...