From a2ce16f8bfdb16ac485b8c4ad9a51ade5c256a5b Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Mon, 1 Aug 2016 09:01:14 -0400 Subject: [PATCH] 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 --- src/client/Client.cc | 11 +++++------ src/client/Client.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index a2d3b743a6ea2..311facbc3994f 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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: diff --git a/src/client/Client.h b/src/client/Client.h index 775cfdcd4f58c..1cbaa07431eac 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -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); -- 2.39.5