From: Sage Weil Date: Sat, 19 Jan 2013 01:21:37 +0000 (-0800) Subject: client: move xattr namespace enforcement into internal method X-Git-Tag: v0.57~84^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=febb96509559084357bfaabf7e4d28e494c274aa;p=ceph.git client: move xattr namespace enforcement into internal method This captures libcephfs users now too. Signed-off-by: Sage Weil --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 76fb8fa5a4af..046124062b78 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -6515,6 +6515,13 @@ int Client::_setxattr(Inode *in, const char *name, const void *value, size_t siz return -EROFS; } + // same xattrs supported by kernel client + if (strncmp(name, "user.", 5) && + strncmp(name, "security.", 9) && + strncmp(name, "trusted.", 8) && + strncmp(name, "ceph.", 5)) + return -EOPNOTSUPP; + MetaRequest *req = new MetaRequest(CEPH_MDS_OP_SETXATTR); filepath path; in->make_nosnap_relative_path(path); @@ -6543,13 +6550,6 @@ int Client::ll_setxattr(vinodeno_t vino, const char *name, const void *value, si tout(cct) << vino.ino.val << std::endl; tout(cct) << name << std::endl; - // same xattrs supported by kernel client - if (strncmp(name, "user.", 5) && - strncmp(name, "security.", 9) && - strncmp(name, "trusted.", 8) && - strncmp(name, "ceph.", 5)) - return -EOPNOTSUPP; - Inode *in = _ll_get_inode(vino); return _setxattr(in, name, value, size, flags, uid, gid); } @@ -6560,6 +6560,13 @@ int Client::_removexattr(Inode *in, const char *name, int uid, int gid) return -EROFS; } + // same xattrs supported by kernel client + if (strncmp(name, "user.", 5) && + strncmp(name, "security.", 9) && + strncmp(name, "trusted.", 8) && + strncmp(name, "ceph.", 5)) + return -EOPNOTSUPP; + MetaRequest *req = new MetaRequest(CEPH_MDS_OP_RMXATTR); filepath path; in->make_nosnap_relative_path(path); @@ -6583,13 +6590,6 @@ int Client::ll_removexattr(vinodeno_t vino, const char *name, int uid, int gid) tout(cct) << vino.ino.val << std::endl; tout(cct) << name << std::endl; - // same xattrs supported by kernel client - if (strncmp(name, "user.", 5) && - strncmp(name, "security.", 9) && - strncmp(name, "trusted.", 8) && - strncmp(name, "ceph.", 5)) - return -EOPNOTSUPP; - Inode *in = _ll_get_inode(vino); return _removexattr(in, name, uid, gid); }