OSDN Git Service

xfs: also remove cached ACLs when removing the underlying attr
authorChristoph Hellwig <hch@lst.de>
Tue, 7 Jan 2020 23:25:38 +0000 (15:25 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 9 Jan 2020 18:55:18 +0000 (10:55 -0800)
We should not just invalidate the ACL when setting the underlying
attribute, but also when removing it.  The ioctl interface gets that
right, but the normal xattr inteface skipped the xfs_forget_acl due
to an early return.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_xattr.c

index 383f020..2288f20 100644 (file)
@@ -74,10 +74,11 @@ xfs_xattr_set(const struct xattr_handler *handler, struct dentry *unused,
        if (flags & XATTR_REPLACE)
                xflags |= ATTR_REPLACE;
 
-       if (!value)
-               return xfs_attr_remove(ip, (unsigned char *)name, xflags);
-       error = xfs_attr_set(ip, (unsigned char *)name,
+       if (value)
+               error = xfs_attr_set(ip, (unsigned char *)name,
                                (void *)value, size, xflags);
+       else
+               error = xfs_attr_remove(ip, (unsigned char *)name, xflags);
        if (!error)
                xfs_forget_acl(inode, name, xflags);