]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: repair extended attributes
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:22:39 +0000 (16:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:00 +0000 (17:01 -0700)
Source kernel commit: e47dcf113ae348678143cc935a1183059c02c9ad

If the extended attributes look bad, try to sift through the rubble to
find whatever keys/values we can, stage a new attribute structure in a
temporary file and use the atomic extent swapping mechanism to commit
the results in bulk.

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

index cc291cf7619a140d53eb0c860808d0b2c1da131a..07f8739270da67ff43778a2b735c3098802f5e30 100644 (file)
@@ -1053,7 +1053,7 @@ out_trans_cancel:
  * External routines when attribute list is inside the inode
  *========================================================================*/
 
-static inline int xfs_attr_sf_totsize(struct xfs_inode *dp)
+int xfs_attr_sf_totsize(struct xfs_inode *dp)
 {
        struct xfs_attr_sf_hdr *sf = dp->i_af.if_data;
 
index 81be9b3e40047b928707e620820616407309a197..e4f55008552b4167e4c61ff530cfb7eed85f39ac 100644 (file)
@@ -618,4 +618,6 @@ extern struct kmem_cache *xfs_attr_intent_cache;
 int __init xfs_attr_intent_init_cache(void);
 void xfs_attr_intent_destroy_cache(void);
 
+int xfs_attr_sf_totsize(struct xfs_inode *dp);
+
 #endif /* __XFS_ATTR_H__ */
index 060e5c96b70f63f73a72e2d0942aed5d6b161175..aac3fe0396140d4673ab5da60e850ee0ea0e7f0b 100644 (file)
@@ -721,6 +721,11 @@ struct xfs_attr3_leafblock {
 #define XFS_ATTR_INCOMPLETE    (1u << XFS_ATTR_INCOMPLETE_BIT)
 #define XFS_ATTR_NSP_ONDISK_MASK       (XFS_ATTR_ROOT | XFS_ATTR_SECURE)
 
+#define XFS_ATTR_NAMESPACE_STR \
+       { XFS_ATTR_LOCAL,       "local" }, \
+       { XFS_ATTR_ROOT,        "root" }, \
+       { XFS_ATTR_SECURE,      "secure" }
+
 /*
  * Alignment for namelist and valuelist entries (since they are mixed
  * there can be only one alignment value)