]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: only skip querying the MDS in _lookup when we have the necessary caps
authorJeff Layton <jlayton@redhat.com>
Mon, 1 Aug 2016 13:01:15 +0000 (09:01 -0400)
committerLoic Dachary <ldachary@redhat.com>
Thu, 25 Aug 2016 16:30:35 +0000 (18:30 +0200)
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 <jlayton@redhat.com>
(cherry picked from commit 9e8476743eef195a0a9bc6ef82392a8781e82549)

src/client/Client.cc

index ac249a27150d9961650dcf2d16ec6b326f0ebef4..3b0b00e315a9bab4b9c3c9ec7e8d1161cd0a1b1c 100644 (file)
@@ -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;