]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: add mask parameter to _do_lookup
authorJeff Layton <jlayton@redhat.com>
Mon, 1 Aug 2016 13:01:14 +0000 (09:01 -0400)
committerJeff Layton <jlayton@redhat.com>
Tue, 2 Aug 2016 11:20:08 +0000 (07:20 -0400)
We need to allow callers to specify caps to acquire during a lookup, as
they may need to scrape certain info out of the inode later. Allow them
to pass in a mask. For now, _lookup just passes in 0 for the mask,
but verify_reply_trace passes in the regetattr_mask to match what we'd
request in the _getattr request if there were a traceless reply.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/client/Client.cc
src/client/Client.h

index a2d3b743a6ea2afa266368d88ec91fe15c848d8a..311facbc3994fb8b54cfd9095f88efc15d8dcc7d 100644 (file)
@@ -1550,7 +1550,7 @@ int Client::verify_reply_trace(int r,
                         << " got_ino " << got_created_ino
                         << " ino " << created_ino
                         << dendl;
-         r = _do_lookup(d->dir->parent_inode, d->name, &target, uid, gid);
+         r = _do_lookup(d->dir->parent_inode, d->name, request->regetattr_mask, &target, uid, gid);
        } else {
          // if the dentry is not linked, just do our best. see #5021.
          assert(0 == "how did this happen?  i want logs!");
@@ -5876,7 +5876,7 @@ void Client::renew_caps(MetaSession *session)
 // ===============================================================
 // high level (POSIXy) interface
 
-int Client::_do_lookup(Inode *dir, const string& name, InodeRef *target,
+int Client::_do_lookup(Inode *dir, const string& name, int mask, InodeRef *target,
                       int uid, int gid)
 {
   int op = dir->snapid == CEPH_SNAPDIR ? CEPH_MDS_OP_LOOKUPSNAP : CEPH_MDS_OP_LOOKUP;
@@ -5887,9 +5887,8 @@ int Client::_do_lookup(Inode *dir, const string& name, InodeRef *target,
   req->set_filepath(path);
   req->set_inode(dir);
   if (cct->_conf->client_debug_getattr_caps && op == CEPH_MDS_OP_LOOKUP)
-      req->head.args.getattr.mask = DEBUG_GETATTR_CAPS;
-  else
-      req->head.args.getattr.mask = 0;
+      mask |= DEBUG_GETATTR_CAPS;
+  req->head.args.getattr.mask = mask;
 
   ldout(cct, 10) << "_do_lookup on " << path << dendl;
 
@@ -5980,7 +5979,7 @@ int Client::_lookup(Inode *dir, const string& dname, InodeRef *target,
     }
   }
 
-  r = _do_lookup(dir, dname, target, uid, gid);
+  r = _do_lookup(dir, dname, 0, target, uid, gid);
   goto done;
 
  hit_dn:
index 775cfdcd4f58ca76bc3614303a5a3d66e06ed0c1..1cbaa07431eaccbd5615fde5dfec814ab3ba0ea2 100644 (file)
@@ -750,7 +750,7 @@ private:
 
   // internal interface
   //   call these with client_lock held!
-  int _do_lookup(Inode *dir, const string& name, InodeRef *target, int uid, int gid);
+  int _do_lookup(Inode *dir, const string& name, int mask, InodeRef *target, int uid, int gid);
   int _lookup(Inode *dir, const string& dname, InodeRef *target, int uid, int gid);
 
   int _link(Inode *in, Inode *dir, const char *name, int uid=-1, int gid=-1, InodeRef *inp = 0);