]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: move xattr namespace enforcement into internal method
authorSage Weil <sage@inktank.com>
Sat, 19 Jan 2013 01:21:37 +0000 (17:21 -0800)
committerSage Weil <sage@inktank.com>
Wed, 30 Jan 2013 00:24:45 +0000 (16:24 -0800)
This captures libcephfs users now too.

Signed-off-by: Sage Weil <sage@inktank.com>
src/client/Client.cc

index 76fb8fa5a4af9dfcdcd19ee222e672ceb0db9539..046124062b7862b224e08333ef0e5e141d2c739b 100644 (file)
@@ -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);
 }