From: Greg Farnum Date: Fri, 29 Jul 2016 21:16:02 +0000 (-0700) Subject: client: switch _do_lookup() to UserPerm X-Git-Tag: v11.0.1~36^2~68 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6a7a74391fe2375042069927e220fc5754c934f6;p=ceph.git client: switch _do_lookup() to UserPerm Signed-off-by: Greg Farnum --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 8af7ddda3d64..335bd7be159e 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1516,6 +1516,7 @@ int Client::verify_reply_trace(int r, inodeno_t created_ino; bool got_created_ino = false; ceph::unordered_map::iterator p; + UserPerm perms(uid, gid); extra_bl.claim(reply->get_extra_bl()); if (extra_bl.length() >= 8) { @@ -1550,7 +1551,8 @@ 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, request->regetattr_mask, &target, uid, gid); + r = _do_lookup(d->dir->parent_inode, d->name, request->regetattr_mask, + &target, perms); } else { // if the dentry is not linked, just do our best. see #5021. assert(0 == "how did this happen? i want logs!"); @@ -1559,7 +1561,7 @@ int Client::verify_reply_trace(int r, Inode *in = request->inode(); ldout(cct, 10) << "make_request got traceless reply, forcing getattr on #" << in->ino << dendl; - r = _getattr(in, request->regetattr_mask, uid, gid, true); + r = _getattr(in, request->regetattr_mask, perms, true); target = in; } if (r >= 0) { @@ -5877,8 +5879,8 @@ void Client::renew_caps(MetaSession *session) // =============================================================== // high level (POSIXy) interface -int Client::_do_lookup(Inode *dir, const string& name, int mask, InodeRef *target, - int uid, int gid) +int Client::_do_lookup(Inode *dir, const string& name, int mask, + InodeRef *target, const UserPerm& perms) { int op = dir->snapid == CEPH_SNAPDIR ? CEPH_MDS_OP_LOOKUPSNAP : CEPH_MDS_OP_LOOKUP; MetaRequest *req = new MetaRequest(op); @@ -5893,7 +5895,7 @@ int Client::_do_lookup(Inode *dir, const string& name, int mask, InodeRef *targe ldout(cct, 10) << "_do_lookup on " << path << dendl; - int r = make_request(req, uid, gid, target); + int r = make_request(req, perms, target); ldout(cct, 10) << "_do_lookup res is " << r << dendl; return r; } @@ -5903,6 +5905,7 @@ int Client::_lookup(Inode *dir, const string& dname, int mask, { int r = 0; Dentry *dn = NULL; + UserPerm perms(uid, gid); if (!dir->is_dir()) { r = -ENOTDIR; @@ -5981,7 +5984,7 @@ int Client::_lookup(Inode *dir, const string& dname, int mask, } } - r = _do_lookup(dir, dname, mask, target, uid, gid); + r = _do_lookup(dir, dname, mask, target, perms); goto done; hit_dn: diff --git a/src/client/Client.h b/src/client/Client.h index cf5d50ba09d5..fd8b0d8e8a55 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -778,7 +778,8 @@ private: // internal interface // call these with client_lock held! - int _do_lookup(Inode *dir, const string& name, int mask, InodeRef *target, int uid, int gid); + int _do_lookup(Inode *dir, const string& name, int mask, InodeRef *target, + const UserPerm& perms); int _lookup(Inode *dir, const string& dname, int mask, InodeRef *target, int uid, int gid); int _lookup(Inode *dir, const string& dname, int mask, InodeRef *target, const UserPerm& perm) {