]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: pass UserPerm to get_caps_issued()
authorGreg Farnum <gfarnum@redhat.com>
Wed, 3 Aug 2016 05:49:11 +0000 (22:49 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:53 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/Client.h
src/libcephfs.cc

index 0aa73cb2603782e2e8c55cdc8ff02bca3c81d8ac..3dd713e68bbf20547cca2f94831dc752b2396243 100644 (file)
@@ -9453,12 +9453,12 @@ int Client::get_caps_issued(int fd) {
   return f->inode->caps_issued();
 }
 
-int Client::get_caps_issued(const char *path) {
-
+int Client::get_caps_issued(const char *path, const UserPerm& perms)
+{
   Mutex::Locker lock(client_lock);
   filepath p(path);
   InodeRef in;
-  int r = path_walk(p, &in, true);
+  int r = path_walk(p, &in, perms, true);
   if (r < 0)
     return r;
   return in->caps_issued();
index 9592436ded7f0aedde4520a40434c828ce551dd0..a146d88aafed2a196ddfdcb5f974f94d2c08142e 100644 (file)
@@ -1188,7 +1188,7 @@ public:
 
   // expose caps
   int get_caps_issued(int fd);
-  int get_caps_issued(const char *path);
+  int get_caps_issued(const char *path, const UserPerm& perms);
 
   // low-level interface v2
   inodeno_t ll_get_inodeno(Inode *in) {
index 5accbae84303687a446bd9dcc40722620a89f4e6..89e7dd8ef113fa617cd8ba230ad4d070225d5022 100644 (file)
@@ -927,8 +927,7 @@ extern "C" int ceph_get_file_stripe_unit(struct ceph_mount_info *cmount, int fh)
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  UserPerm perms = cmount->get_client()->pick_my_perms();
-  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
+  r = cmount->get_client()->fdescribe_layout(fh, &l);
   if (r < 0)
     return r;
   return l.stripe_unit;
@@ -955,8 +954,7 @@ extern "C" int ceph_get_file_stripe_count(struct ceph_mount_info *cmount, int fh
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  UserPerm perms = cmount->get_client()->pick_my_perms();
-  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
+  r = cmount->get_client()->fdescribe_layout(fh, &l);
   if (r < 0)
     return r;
   return l.stripe_count;
@@ -983,8 +981,7 @@ extern "C" int ceph_get_file_object_size(struct ceph_mount_info *cmount, int fh)
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  UserPerm perms = cmount->get_client()->pick_my_perms();
-  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
+  r = cmount->get_client()->fdescribe_layout(fh, &l);
   if (r < 0)
     return r;
   return l.object_size;
@@ -1011,8 +1008,7 @@ extern "C" int ceph_get_file_pool(struct ceph_mount_info *cmount, int fh)
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  UserPerm perms = cmount->get_client()->pick_my_perms();
-  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
+  r = cmount->get_client()->fdescribe_layout(fh, &l);
   if (r < 0)
     return r;
   return l.pool_id;
@@ -1039,8 +1035,7 @@ extern "C" int ceph_get_file_pool_name(struct ceph_mount_info *cmount, int fh, c
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  UserPerm perms = cmount->get_client()->pick_my_perms();
-  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
+  r = cmount->get_client()->fdescribe_layout(fh, &l);
   if (r < 0)
     return r;
   string name = cmount->get_client()->get_pool_name(l.pool_id);
@@ -1092,8 +1087,7 @@ extern "C" int ceph_get_file_layout(struct ceph_mount_info *cmount, int fh, int
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  UserPerm perms = cmount->get_client()->pick_my_perms();
-  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
+  r = cmount->get_client()->fdescribe_layout(fh, &l);
   if (r < 0)
     return r;
   if (stripe_unit)
@@ -1136,8 +1130,7 @@ extern "C" int ceph_get_file_replication(struct ceph_mount_info *cmount, int fh)
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  UserPerm perms = cmount->get_client()->pick_my_perms();
-  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
+  r = cmount->get_client()->fdescribe_layout(fh, &l);
   if (r < 0)
     return r;
   int rep = cmount->get_client()->get_pool_replication(l.pool_id);
@@ -1329,7 +1322,8 @@ extern "C" int ceph_debug_get_file_caps(struct ceph_mount_info *cmount, const ch
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  return cmount->get_client()->get_caps_issued(path);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  return cmount->get_client()->get_caps_issued(path, perms);
 }
 
 extern "C" int ceph_get_stripe_unit_granularity(struct ceph_mount_info *cmount)