]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_repair: enforce one namespace bit per extended attribute
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:23:19 +0000 (16:23 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:11 +0000 (17:01 -0700)
Enforce that all extended attributes have at most one namespace bit.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/libxfs_api_defs.h
repair/attr_repair.c

index cc670d93a9f2a89e0549450e44904eb276d6279c..2d858580abfe29f4b8cba498ee03ef7959a388e4 100644 (file)
@@ -36,6 +36,7 @@
 
 #define xfs_ascii_ci_hashname          libxfs_ascii_ci_hashname
 
+#define xfs_attr_check_namespace       libxfs_attr_check_namespace
 #define xfs_attr_get                   libxfs_attr_get
 #define xfs_attr_leaf_newentsize       libxfs_attr_leaf_newentsize
 #define xfs_attr_namecheck             libxfs_attr_namecheck
index 0f2f7a284bdd72f3c0eed3da14f5c5a11a878c8d..a756a40db9b0968f450f56a63d4bb3b92b5fbc9c 100644 (file)
@@ -291,6 +291,13 @@ process_shortform_attr(
                        }
                }
 
+               if (!libxfs_attr_check_namespace(currententry->flags)) {
+                       do_warn(
+       _("multiple namespaces for shortform attribute %d in inode %" PRIu64 "\n"),
+                               i, ino);
+                       junkit = 1;
+               }
+
                /* namecheck checks for null chars in attr names. */
                if (!libxfs_attr_namecheck(currententry->flags,
                                           currententry->nameval,
@@ -641,6 +648,14 @@ process_leaf_attr_block(
                        break;
                }
 
+               if (!libxfs_attr_check_namespace(entry->flags)) {
+                       do_warn(
+       _("multiple namespaces for attribute entry %d in attr block %u, inode %" PRIu64 "\n"),
+                               i, da_bno, ino);
+                       clearit = 1;
+                       break;
+               }
+
                if (entry->flags & XFS_ATTR_INCOMPLETE) {
                        /* we are inconsistent state. get rid of us */
                        do_warn(