[PATCH] xfs_repair: Check for invalid ACL types

Andreas Gruenbacher agruenba at redhat.com
Mon Oct 26 20:23:52 CDT 2015


Filesystems with the richacl feature are not supposed to contain POSIX
ACLs, and filesystems without the richacl feature are not supposed to
contain richacls.  Fix by removing unexpected attributes.

Signed-off-by: Andreas Gruenbacher <agruenba at redhat.com>
---
 repair/attr_repair.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/repair/attr_repair.c b/repair/attr_repair.c
index e7f03a8..8ded369 100644
--- a/repair/attr_repair.c
+++ b/repair/attr_repair.c
@@ -160,6 +160,8 @@ valuecheck(
 	int		namelen,
 	int		valuelen)
 {
+	const bool feature_richacl = xfs_sb_has_incompat_feature(&mp->m_sb,
+		XFS_SB_FEAT_INCOMPAT_RICHACL);
 	/* for proper alignment issues, get the structs and memmove the values */
 	xfs_mac_label_t macl;
 	void *valuep;
@@ -169,6 +171,13 @@ valuecheck(
 	     strncmp(namevalue, SGI_ACL_FILE, SGI_ACL_FILE_SIZE) == 0) ||
 	    (namelen == SGI_ACL_DEFAULT_SIZE &&
 	     strncmp(namevalue, SGI_ACL_DEFAULT, SGI_ACL_DEFAULT_SIZE) == 0)) {
+		if (feature_richacl) {
+			do_warn(_("filesystem feature %s set "
+				  "but attribute %.*s exists\n"),
+				"richacl", namelen, namevalue);
+			return 1;
+		}
+
 		if (value == NULL) {
 			valuep = malloc(valuelen);
 			if (!valuep)
@@ -211,6 +220,13 @@ valuecheck(
 		 strncmp(namevalue, XATTR_RICHACL, strlen(XATTR_RICHACL)) == 0) {
 		struct richacl *acl;
 
+		if (!feature_richacl) {
+			do_warn(_("filesystem feature %s not set "
+				  "but attribute %.*s exists\n"),
+				"richacl", namelen, namevalue);
+			return 1;
+		}
+
 		if (value == NULL) {
 			valuep = malloc(valuelen);
 			if (!valuep)
-- 
2.5.0



More information about the xfs mailing list