From: Greg Farnum Date: Wed, 3 Aug 2016 05:49:11 +0000 (-0700) Subject: client: pass UserPerm to get_caps_issued() X-Git-Tag: v11.0.1~36^2~38 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=540c9a8d9c1d842d125b4c076eb68b6c8bee7b29;p=ceph.git client: pass UserPerm to get_caps_issued() Signed-off-by: Greg Farnum --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 0aa73cb2603..3dd713e68bb 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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(); diff --git a/src/client/Client.h b/src/client/Client.h index 9592436ded7..a146d88aafe 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -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) { diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 5accbae8430..89e7dd8ef11 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -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)