From: Greg Farnum Date: Wed, 3 Aug 2016 05:44:17 +0000 (-0700) Subject: client: pass UserPerm to describe_layout() X-Git-Tag: v11.0.1~36^2~39 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=98195878b12e85bcd338b424e8805ad3e89ca1f2;p=ceph.git client: pass UserPerm to describe_layout() Signed-off-by: Greg Farnum --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 4dc04b05afb8..0aa73cb26037 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11856,13 +11856,14 @@ void Client::ll_interrupt(void *d) // expose file layouts -int Client::describe_layout(const char *relpath, file_layout_t *lp) +int Client::describe_layout(const char *relpath, file_layout_t *lp, + const UserPerm& perms) { Mutex::Locker lock(client_lock); filepath path(relpath); InodeRef in; - int r = path_walk(path, &in); + int r = path_walk(path, &in, perms); if (r < 0) return r; diff --git a/src/client/Client.h b/src/client/Client.h index b02871e6e693..9592436ded7f 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -1166,7 +1166,8 @@ public: int lazyio_synchronize(int fd, loff_t offset, size_t count); // expose file layout - int describe_layout(const char *path, file_layout_t* layout); + int describe_layout(const char *path, file_layout_t* layout, + const UserPerm& perms); int fdescribe_layout(int fd, file_layout_t* layout); int get_file_stripe_address(int fd, loff_t offset, vector& address); int get_file_extent_osds(int fd, loff_t off, loff_t *len, vector& osds); diff --git a/src/libcephfs.cc b/src/libcephfs.cc index ccace2907f0e..5accbae84303 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -927,7 +927,8 @@ extern "C" int ceph_get_file_stripe_unit(struct ceph_mount_info *cmount, int fh) if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->fdescribe_layout(fh, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->fdescribe_layout(fh, &l, perms); if (r < 0) return r; return l.stripe_unit; @@ -940,7 +941,8 @@ extern "C" int ceph_get_path_stripe_unit(struct ceph_mount_info *cmount, const c if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->describe_layout(path, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->describe_layout(path, &l, perms); if (r < 0) return r; return l.stripe_unit; @@ -953,7 +955,8 @@ extern "C" int ceph_get_file_stripe_count(struct ceph_mount_info *cmount, int fh if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->fdescribe_layout(fh, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->fdescribe_layout(fh, &l, perms); if (r < 0) return r; return l.stripe_count; @@ -966,7 +969,8 @@ extern "C" int ceph_get_path_stripe_count(struct ceph_mount_info *cmount, const if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->describe_layout(path, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->describe_layout(path, &l, perms); if (r < 0) return r; return l.stripe_count; @@ -979,7 +983,8 @@ extern "C" int ceph_get_file_object_size(struct ceph_mount_info *cmount, int fh) if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->fdescribe_layout(fh, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->fdescribe_layout(fh, &l, perms); if (r < 0) return r; return l.object_size; @@ -992,7 +997,8 @@ extern "C" int ceph_get_path_object_size(struct ceph_mount_info *cmount, const c if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->describe_layout(path, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->describe_layout(path, &l, perms); if (r < 0) return r; return l.object_size; @@ -1005,7 +1011,8 @@ extern "C" int ceph_get_file_pool(struct ceph_mount_info *cmount, int fh) if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->fdescribe_layout(fh, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->fdescribe_layout(fh, &l, perms); if (r < 0) return r; return l.pool_id; @@ -1018,7 +1025,8 @@ extern "C" int ceph_get_path_pool(struct ceph_mount_info *cmount, const char *pa if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->describe_layout(path, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->describe_layout(path, &l, perms); if (r < 0) return r; return l.pool_id; @@ -1031,7 +1039,8 @@ extern "C" int ceph_get_file_pool_name(struct ceph_mount_info *cmount, int fh, c if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->fdescribe_layout(fh, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->fdescribe_layout(fh, &l, perms); if (r < 0) return r; string name = cmount->get_client()->get_pool_name(l.pool_id); @@ -1063,7 +1072,8 @@ extern "C" int ceph_get_path_pool_name(struct ceph_mount_info *cmount, const cha if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->describe_layout(path, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->describe_layout(path, &l, perms); if (r < 0) return r; string name = cmount->get_client()->get_pool_name(l.pool_id); @@ -1082,7 +1092,8 @@ extern "C" int ceph_get_file_layout(struct ceph_mount_info *cmount, int fh, int if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->fdescribe_layout(fh, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->fdescribe_layout(fh, &l, perms); if (r < 0) return r; if (stripe_unit) @@ -1103,7 +1114,8 @@ extern "C" int ceph_get_path_layout(struct ceph_mount_info *cmount, const char * if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->describe_layout(path, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->describe_layout(path, &l, perms); if (r < 0) return r; if (stripe_unit) @@ -1124,7 +1136,8 @@ extern "C" int ceph_get_file_replication(struct ceph_mount_info *cmount, int fh) if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->fdescribe_layout(fh, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->fdescribe_layout(fh, &l, perms); if (r < 0) return r; int rep = cmount->get_client()->get_pool_replication(l.pool_id); @@ -1138,7 +1151,8 @@ extern "C" int ceph_get_path_replication(struct ceph_mount_info *cmount, const c if (!cmount->is_mounted()) return -ENOTCONN; - r = cmount->get_client()->describe_layout(path, &l); + UserPerm perms = cmount->get_client()->pick_my_perms(); + r = cmount->get_client()->describe_layout(path, &l, perms); if (r < 0) return r; int rep = cmount->get_client()->get_pool_replication(l.pool_id);