]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: check xattr readonly flag on setxattr, removexattr
authorSage Weil <sage@newdream.net>
Mon, 28 Sep 2009 17:06:48 +0000 (10:06 -0700)
committerSage Weil <sage@newdream.net>
Mon, 28 Sep 2009 17:09:26 +0000 (10:09 -0700)
src/kernel/xattr.c

index 669186ead56a0b38dcb688c8d2d5bbc9dcf43c04..2c552586820fc6323d78f4f7957d8a9db04a0552 100644 (file)
@@ -698,8 +698,12 @@ int ceph_setxattr(struct dentry *dentry, const char *name,
        if (!ceph_is_valid_xattr(name))
                return -EOPNOTSUPP;
 
-       if (vxattrs && ceph_match_vxattr(vxattrs, name) != NULL)
-               return -EOPNOTSUPP;
+       if (vxattrs) {
+               struct ceph_vxattr_cb *vxattr =
+                       ceph_match_vxattr(vxattrs, name);
+               if (vxattr && vxattr->readonly)
+                       return -EOPNOTSUPP;
+       }
 
        /* preallocate memory for xattr name, value, index node */
        err = -ENOMEM;
@@ -803,8 +807,12 @@ int ceph_removexattr(struct dentry *dentry, const char *name)
        if (!ceph_is_valid_xattr(name))
                return -EOPNOTSUPP;
 
-       if (vxattrs && ceph_match_vxattr(vxattrs, name) != NULL)
-               return -EOPNOTSUPP;
+       if (vxattrs) {
+               struct ceph_vxattr_cb *vxattr =
+                       ceph_match_vxattr(vxattrs, name);
+               if (vxattr && vxattr->readonly)
+                       return -EOPNOTSUPP;
+       }
 
        spin_lock(&inode->i_lock);
        __build_xattrs(inode);