]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: switch _do_lookup() to UserPerm
authorGreg Farnum <gfarnum@redhat.com>
Fri, 29 Jul 2016 21:16:02 +0000 (14:16 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:48 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/Client.h

index 8af7ddda3d648e28c4a7a22f627b402860689ae1..335bd7be159e7d3e09d78b7bff8bc7536cea7e2f 100644 (file)
@@ -1516,6 +1516,7 @@ int Client::verify_reply_trace(int r,
   inodeno_t created_ino;
   bool got_created_ino = false;
   ceph::unordered_map<vinodeno_t, Inode*>::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:
index cf5d50ba09d5d3893562fec842b0bebaab13896c..fd8b0d8e8a55c6749b205d04e57033892fdd3cdf 100644 (file)
@@ -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) {