From: Jeff Layton Date: Mon, 24 Oct 2016 14:03:00 +0000 (-0400) Subject: client: change ceph_ll_symlinkx to take a UserPerm and ceph_statx X-Git-Tag: v11.1.0~383^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=236044554ad917e916958f97e1cf17ab39683e20;p=ceph.git client: change ceph_ll_symlinkx to take a UserPerm and ceph_statx Signed-off-by: Jeff Layton --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 12cd46471728..340f88696e8c 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11234,6 +11234,40 @@ int Client::ll_symlink(Inode *parent, const char *name, const char *value, return r; } +int Client::ll_symlinkx(Inode *parent, const char *name, const char *value, + Inode **out, struct ceph_statx *stx, unsigned want, + unsigned flags, const UserPerm& perms) +{ + Mutex::Locker lock(client_lock); + + vinodeno_t vparent = _get_vino(parent); + + ldout(cct, 3) << "ll_symlinkx " << vparent << " " << name << " -> " << value + << dendl; + tout(cct) << "ll_symlinkx" << std::endl; + tout(cct) << vparent.ino.val << std::endl; + tout(cct) << name << std::endl; + tout(cct) << value << std::endl; + + if (!cct->_conf->fuse_default_permissions) { + int r = may_create(parent, perms); + if (r < 0) + return r; + } + + InodeRef in; + int r = _symlink(parent, name, value, perms, &in); + if (r == 0) { + fill_statx(in, statx_to_mask(flags, want), stx); + _ll_get(in.get()); + } + tout(cct) << stx->stx_ino << std::endl; + ldout(cct, 3) << "ll_symlinkx " << vparent << " " << name + << " = " << r << " (" << hex << stx->stx_ino << dec << ")" << dendl; + *out = in.get(); + return r; +} + int Client::_unlink(Inode *dir, const char *name, const UserPerm& perm) { ldout(cct, 3) << "_unlink(" << dir->ino << " " << name diff --git a/src/client/Client.h b/src/client/Client.h index cbe7b1fb32f8..c3e6ffdfc077 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -1149,6 +1149,9 @@ public: const UserPerm& perms); int ll_symlink(Inode *in, const char *name, const char *value, struct stat *attr, Inode **out, const UserPerm& perms); + int ll_symlinkx(Inode *parent, const char *name, const char *value, + Inode **out, struct ceph_statx *stx, unsigned want, + unsigned flags, const UserPerm& perms); int ll_unlink(Inode *in, const char *name, const UserPerm& perm); int ll_rmdir(Inode *in, const char *name, const UserPerm& perms); int ll_rename(Inode *parent, const char *name, Inode *newparent, diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h index 5d5f8a068618..a5802eebeedb 100644 --- a/src/include/cephfs/libcephfs.h +++ b/src/include/cephfs/libcephfs.h @@ -1505,9 +1505,11 @@ int ceph_ll_statfs(struct ceph_mount_info *cmount, struct Inode *in, struct statvfs *stbuf); int ceph_ll_readlink(struct ceph_mount_info *cmount, struct Inode *in, char *buf, size_t bufsize, int uid, int gid); -int ceph_ll_symlink(struct ceph_mount_info *cmount, struct Inode *parent, - const char *name, const char *value, struct stat *attr, - struct Inode **in, int uid, int gid); +int ceph_ll_symlink(struct ceph_mount_info *cmount, + Inode *in, const char *name, const char *value, + Inode **out, struct ceph_statx *stx, + unsigned want, unsigned flags, + const UserPerm *perms); int ceph_ll_rmdir(struct ceph_mount_info *cmount, struct Inode *in, const char *name, int uid, int gid); uint32_t ceph_ll_stripe_unit(struct ceph_mount_info *cmount, diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 97cfc6b551d2..ea6802973387 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -1620,11 +1620,12 @@ extern "C" int ceph_ll_readlink(class ceph_mount_info *cmount, extern "C" int ceph_ll_symlink(class ceph_mount_info *cmount, Inode *in, const char *name, - const char *value, struct stat *attr, - Inode **out, int uid, int gid) + const char *value, Inode **out, + struct ceph_statx *stx, unsigned want, + unsigned flags, const UserPerm *perms) { - UserPerm perms(uid, gid); - return (cmount->get_client()->ll_symlink(in, name, value, attr, out, perms)); + return (cmount->get_client()->ll_symlinkx(in, name, value, out, stx, want, + flags, *perms)); } extern "C" int ceph_ll_rmdir(class ceph_mount_info *cmount,