From: Jeff Layton Date: Mon, 1 Aug 2016 13:01:14 +0000 (-0400) Subject: client: add mask parameter to _do_lookup X-Git-Tag: v10.2.4~69^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b5cbd5766fbf2a9ff5ee0e58b4ea42c706f4505a;p=ceph.git client: add mask parameter to _do_lookup 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 (cherry picked from commit a2ce16f8bfdb16ac485b8c4ad9a51ade5c256a5b) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index b465cadec55f..17b4b754124c 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1571,7 +1571,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!"); @@ -5837,7 +5837,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; @@ -5848,9 +5848,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; @@ -5941,7 +5940,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: diff --git a/src/client/Client.h b/src/client/Client.h index 84179463419e..a5454c210c25 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -756,7 +756,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);