]> git.apps.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)
committerJeff Layton <jlayton@redhat.com>
Tue, 2 Aug 2016 11:20:08 +0000 (07:20 -0400)
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>
src/client/Client.cc

index c4ee87acb7542d70de1e4072eba1b925450ce56b..93ffd07bb29c9e481cc12aa48dd1dc3fb39145bb 100644 (file)
@@ -5940,7 +5940,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 &&
@@ -5959,8 +5959,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;