diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2012-11-19 10:43:48 +0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-12-01 12:52:23 -0800 |
commit | 2a5068944ef73c55a60e3333b5641177c5381db9 (patch) | |
tree | 5f6b13748775a9691c58c927c485dc6ff2676128 | |
parent | 1203cd21104d131e459891392ac1fbf52bd0160d (diff) | |
download | ceph-2a5068944ef73c55a60e3333b5641177c5381db9.tar.gz |
mds: use rdlock_try() when checking NULL dentry
Use rdlock_try() instead can_read() when path_traverse encounters
a NULL dentry. This can partly avoid infinitely waiting for the
dentry to become readable when the dentry is replica.
Strictly speaking, use rdlock_try() is still enough because auth
MDS may drop the REQRDLOCK message in some cases.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
-rw-r--r-- | src/mds/MDCache.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index d45a8143730..585364d3f05 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6707,11 +6707,11 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req, Context *fin, // wh // can we conclude ENOENT? if (dnl && dnl->is_null()) { - if (dn->lock.can_read(client)) { - dout(12) << "traverse: miss on null+readable dentry " << path[depth] << " " << *dn << dendl; + if (mds->locker->rdlock_try(&dn->lock, client, NULL)) { + dout(10) << "traverse: miss on null+readable dentry " << path[depth] << " " << *dn << dendl; return -ENOENT; } else { - dout(12) << "miss on dentry " << *dn << ", can't read due to lock" << dendl; + dout(10) << "miss on dentry " << *dn << ", can't read due to lock" << dendl; dn->lock.add_waiter(SimpleLock::WAIT_RD, _get_waiter(mdr, req, fin)); return 1; } |