[PATCH 1/2] xfs: Fixes to "invalidate cached acl if set directly via xattr"

Andreas Gruenbacher agruenba at redhat.com
Mon Nov 2 13:52:53 CST 2015


Don't match arbitrary name prefixes like "S" when checking for the
attribute names "SGI_ACL_{FILE,DEFAULT}".

Function forget_cached_acl only exists in kernels that have POSIX ACL
support; guard calls to that function by CONFIG_XFS_POSIX_ACL.

Signed-off-by: Andreas Gruenbacher <agruenba at kernel.org>
---
 fs/xfs/xfs_xattr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 2e1eb80..1542d64 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -80,10 +80,12 @@ xfs_xattr_set(struct dentry *dentry, const char *name, const void *value,
 	 * consistent.
 	 */
 	if (!error && (xflags & ATTR_ROOT)) {
-		if (!strncmp(name, SGI_ACL_FILE, strlen(name)))
+#ifdef CONFIG_XFS_POSIX_ACL
+		if (!strcmp(name, SGI_ACL_FILE)
 			forget_cached_acl(VFS_I(ip), ACL_TYPE_ACCESS);
-		else if (!strncmp(name, SGI_ACL_DEFAULT, strlen(name)))
+		else if (!strcmp(name, SGI_ACL_DEFAULT))
 			forget_cached_acl(VFS_I(ip), ACL_TYPE_DEFAULT);
+#endif
 	}
 
 	return error;
-- 
2.5.0



More information about the xfs mailing list