Hi all, This series employs atomic extent swapping to enable safe reconstruction of extended attribute data. Extended attribute repair consists of four main parts: First, we walk the existing attributes to salvage as many of them as we can, by adding them as new attributes attached to the repair tempfile. Second, we prepare the temp file by changing the inode owner field in the attr block headers. Third, we use atomic extent swaps to exchange the entire attribute fork between the two files. Finally, we tear down the old attr data (which is now in the temporary file) as carefully as we can. If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below. This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-xattrs xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-xattrs --- fs/xfs/Makefile | 2 fs/xfs/libxfs/xfs_attr.c | 2 fs/xfs/libxfs/xfs_attr.h | 1 fs/xfs/scrub/array.c | 24 + fs/xfs/scrub/array.h | 2 fs/xfs/scrub/attr.c | 9 fs/xfs/scrub/attr.h | 10 fs/xfs/scrub/attr_repair.c | 1393 ++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/scrub/bitmap.c | 22 + fs/xfs/scrub/bitmap.h | 1 fs/xfs/scrub/blob.c | 167 +++++ fs/xfs/scrub/blob.h | 26 + fs/xfs/scrub/dabtree.c | 16 + fs/xfs/scrub/dabtree.h | 1 fs/xfs/scrub/repair.c | 136 ++++ fs/xfs/scrub/repair.h | 9 fs/xfs/scrub/scrub.c | 2 fs/xfs/scrub/scrub.h | 3 fs/xfs/scrub/trace.c | 1 fs/xfs/scrub/trace.h | 86 +++ fs/xfs/xfs_buf.c | 9 fs/xfs/xfs_buf.h | 9 22 files changed, 1927 insertions(+), 4 deletions(-) create mode 100644 fs/xfs/scrub/attr_repair.c create mode 100644 fs/xfs/scrub/blob.c create mode 100644 fs/xfs/scrub/blob.h