From: Jeff Layton Date: Mon, 1 Aug 2016 13:01:15 +0000 (-0400) Subject: client: only skip querying the MDS in _lookup when we have the necessary caps X-Git-Tag: v10.2.4~69^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=66cd43bfedddbbc82e3c303554f089f20eabf0f6;p=ceph.git client: only skip querying the MDS in _lookup when we have the necessary caps If we don't have the caps we'll need later, then we must reissue the lookup to get them regardless of whether we have a lease on the dentry. Fixes: http://tracker.ceph.com/issues/16668 Signed-off-by: Jeff Layton (cherry picked from commit 9e8476743eef195a0a9bc6ef82392a8781e82549) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index ac249a27150d..3b0b00e315a9 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -5901,7 +5901,7 @@ int Client::_lookup(Inode *dir, const string& dname, int mask, << " seq " << dn->lease_seq << dendl; - if (!dn->inode || dn->inode->is_any_caps()) { + if (!dn->inode || dn->inode->caps_issued_mask(mask)) { // is dn lease valid? utime_t now = ceph_clock_now(cct); if (dn->lease_mds >= 0 && @@ -5920,8 +5920,9 @@ int Client::_lookup(Inode *dir, const string& dname, int mask, } // dir lease? if (dir->caps_issued_mask(CEPH_CAP_FILE_SHARED)) { - if (dn->cap_shared_gen == dir->shared_gen) - goto hit_dn; + if (dn->cap_shared_gen == dir->shared_gen && + (!dn->inode || dn->inode->caps_issued_mask(mask))) + goto hit_dn; if (!dn->inode && (dir->flags & I_COMPLETE)) { ldout(cct, 10) << "_lookup concluded ENOENT locally for " << *dir << " dn '" << dname << "'" << dendl;