]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: pass UserPerm to lookup_ino()
authorGreg Farnum <gfarnum@redhat.com>
Sat, 30 Jul 2016 02:02:56 +0000 (19:02 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:51 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/Client.h
src/client/SyntheticClient.cc
src/client/SyntheticClient.h
src/libcephfs.cc

index 5219cb60c9f45f400d2060a2f1b70ea0f934348f..5f441fb4c47b9b99c6a8cc7c6b89afdff615a3b8 100644 (file)
@@ -7606,7 +7606,7 @@ int Client::lookup_hash(inodeno_t ino, inodeno_t dirino, const char *name,
  * the resulting Inode object in one operation, so that caller
  * can safely assume inode will still be there after return.
  */
-int Client::lookup_ino(inodeno_t ino, Inode **inode)
+int Client::lookup_ino(inodeno_t ino, const UserPerm& perms, Inode **inode)
 {
   Mutex::Locker lock(client_lock);
   ldout(cct, 3) << "lookup_ino enter(" << ino << ") = " << dendl;
@@ -7615,7 +7615,6 @@ int Client::lookup_ino(inodeno_t ino, Inode **inode)
   filepath path(ino);
   req->set_filepath(path);
 
-  UserPerm perms(get_uid(), get_gid()); // FIXME
   int r = make_request(req, perms, NULL, NULL, rand() % mdsmap->get_num_in_mds());
   if (r == 0 && inode != NULL) {
     vinodeno_t vino(ino, CEPH_NOSNAP);
index 96dda3d30af2801a318790fc3d5ce0c828f86a6e..bf0e51cbdf3739f7beb35f17f3b0e098a67d4edb 100644 (file)
@@ -1123,7 +1123,7 @@ public:
   int open(const char *path, int flags, mode_t mode, int stripe_unit, int stripe_count, int object_size, const char *data_pool);
   int lookup_hash(inodeno_t ino, inodeno_t dirino, const char *name,
                  const UserPerm& perms);
-  int lookup_ino(inodeno_t ino, Inode **inode=NULL);
+  int lookup_ino(inodeno_t ino, const UserPerm& perms, Inode **inode=NULL);
   int lookup_parent(Inode *in, Inode **parent=NULL);
   int lookup_name(Inode *in, Inode *parent);
   int close(int fd);
index 434418193de5008d47ae55196f10d403a2654981..f525b95efd83188f82e09a13dca770a554eb3270 100644 (file)
@@ -887,7 +887,7 @@ int SyntheticClient::run()
        string iname = get_sarg(0);
        sscanf(iname.c_str(), "%llx", (long long unsigned*)&ino.val);
        if (run_me()) {
-         lookup_ino(ino);
+         lookup_ino(ino, perms);
        }
       }
       break;
@@ -3344,9 +3344,9 @@ int SyntheticClient::lookup_hash(inodeno_t ino, inodeno_t dirino,
   return r;
 }
 
-int SyntheticClient::lookup_ino(inodeno_t ino)
+int SyntheticClient::lookup_ino(inodeno_t ino, const UserPerm& perms)
 {
-  int r = client->lookup_ino(ino);
+  int r = client->lookup_ino(ino, perms);
   dout(0) << "lookup_ino(" << ino << ") = " << r << dendl;
   return r;
 }
index dadbbd08df74bfbbd50eaa75cc9c053ecf7be41c..755f5e0ef093fff167b7e716c31164191c2740bb 100644 (file)
@@ -267,7 +267,7 @@ class SyntheticClient {
 
   int lookup_hash(inodeno_t ino, inodeno_t dirino, const char *name,
                  const UserPerm& perms);
-  int lookup_ino(inodeno_t ino);
+  int lookup_ino(inodeno_t ino, const UserPerm& perms);
 
   int chunk_file(string &filename);
 
index 527ba44672e23f380d363ab7debf1771286a0a91..12a5d9ed034129fc6767abc85e19e1e041ccec73 100644 (file)
@@ -1373,7 +1373,8 @@ extern "C" int ceph_ll_lookup_inode(
     struct inodeno_t ino,
     Inode **inode)
 {
-  int r = (cmount->get_client())->lookup_ino(ino, inode);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  int r = (cmount->get_client())->lookup_ino(ino, perms, inode);
   if (r) {
     return r;
   }