X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzpl_xattr.c;h=cf52e720d96468050c5ec957919f739c960e3d8c;hb=86f35f34f419f6eaff53b25f463c13f72186b103;hp=82787cb2d29c23269ad96ba542fdd403f9956705;hpb=81e97e21872a9c38ad66c37fafe1436ee25abee3;p=zfs.git diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c index 82787cb..cf52e72 100644 --- a/module/zfs/zpl_xattr.c +++ b/module/zfs/zpl_xattr.c @@ -83,7 +83,7 @@ zpl_xattr_filldir(void *arg, const char *name, int name_len, xattr_filldir_t *xf = arg; if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) - if (!(ITOZSB(xf->inode)->z_flags & ZSB_XATTR_USER)) + if (!(ITOZSB(xf->inode)->z_flags & ZSB_XATTR)) return (0); if (!strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN)) @@ -191,6 +191,7 @@ zpl_xattr_set(struct inode *ip, const char *name, const void *value, cred_t *cr = CRED(); ssize_t wrote; int error; + const int xattr_mode = S_IFREG | 0644; crhold(cr); @@ -230,7 +231,7 @@ zpl_xattr_set(struct inode *ip, const char *name, const void *value, /* Lookup failed create a new xattr. */ if (xip == NULL) { vap = kmem_zalloc(sizeof(vattr_t), KM_SLEEP); - vap->va_mode = S_IFREG | 0644; + vap->va_mode = xattr_mode; vap->va_mask = ATTR_MODE; vap->va_uid = crgetfsuid(cr); vap->va_gid = crgetfsgid(cr); @@ -242,6 +243,11 @@ zpl_xattr_set(struct inode *ip, const char *name, const void *value, } ASSERT(xip != NULL); + + error = -zfs_freesp(ITOZ(xip), 0, 0, xattr_mode, TRUE); + if (error) + goto out; + wrote = zpl_write_common(xip, value, size, 0, UIO_SYSSPACE, 0, cr); if (wrote < 0) error = wrote; @@ -275,7 +281,7 @@ __zpl_xattr_user_get(struct inode *ip, const char *name, if (strcmp(name, "") == 0) return -EINVAL; - if (!(ITOZSB(ip)->z_flags & ZSB_XATTR_USER)) + if (!(ITOZSB(ip)->z_flags & ZSB_XATTR)) return -EOPNOTSUPP; xattr_name = kmem_asprintf("%s%s", XATTR_USER_PREFIX, name); @@ -296,7 +302,7 @@ __zpl_xattr_user_set(struct inode *ip, const char *name, if (strcmp(name, "") == 0) return -EINVAL; - if (!(ITOZSB(ip)->z_flags & ZSB_XATTR_USER)) + if (!(ITOZSB(ip)->z_flags & ZSB_XATTR)) return -EOPNOTSUPP; xattr_name = kmem_asprintf("%s%s", XATTR_USER_PREFIX, name); @@ -398,14 +404,16 @@ __zpl_xattr_security_set(struct inode *ip, const char *name, ZPL_XATTR_SET_WRAPPER(zpl_xattr_security_set); int -zpl_xattr_security_init(struct inode *ip, struct inode *dip) +zpl_xattr_security_init(struct inode *ip, struct inode *dip, + const struct qstr *qstr) { int error; size_t len; void *value; char *name; - error = security_inode_init_security(ip, dip, &name, &value, &len); + error = zpl_security_inode_init_security(ip, dip, qstr, + &name, &value, &len); if (error) { if (error == -EOPNOTSUPP) return 0;