Hi all, This series implements online checking and repair for directory parent pointer metadata. The checking half is fairly straightforward -- for each outgoing directory link (forward or backwards), grab the inode at the other end, and confirm that there's a corresponding link. If we can't grab an inode or lock it, we'll save that link for a slower loop that cycles all the locks, confirms the continued existence of the link, and rechecks the link if it's actually still there. Repairs are a bit more involved -- for directories, we walk the entire filesystem to rebuild the dirents from parent pointer information. Parent pointer repairs do the same walk but rebuild the pptrs from the dirent information, but with the added twist that it duplicates all the xattrs so that it can use the atomic extent swapping code to commit the repairs atomically. This introduces an added twist to the xattr repair code -- we use dirent hooks to detect a colliding update to the pptr data while we're not holding the ILOCKs; if one is detected, we restart the xattr salvaging process but this time hold all the ILOCKs until the end of the scan. For offline repair, the phase6 directory connectivity scan generates an index of all the expected parent pointers in the filesystem. Then it walks each file and compares the parent pointers attached to that file against the index generated, and resyncs the results as necessary. If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. This has been running on the djcloud for months with no problems. 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=pptrs-fsck xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=pptrs-fsck --- fs/xfs/Makefile | 2 fs/xfs/libxfs/xfs_attr.c | 39 + fs/xfs/libxfs/xfs_attr.h | 2 fs/xfs/libxfs/xfs_bmap.c | 38 - fs/xfs/libxfs/xfs_bmap.h | 3 fs/xfs/libxfs/xfs_dir2.c | 2 fs/xfs/libxfs/xfs_dir2.h | 2 fs/xfs/libxfs/xfs_parent.c | 107 +++ fs/xfs/libxfs/xfs_parent.h | 18 + fs/xfs/scrub/attr.c | 2 fs/xfs/scrub/attr_repair.c | 502 ++++++++++++++++ fs/xfs/scrub/attr_repair.h | 4 fs/xfs/scrub/common.h | 1 fs/xfs/scrub/dir.c | 352 +++++++++++ fs/xfs/scrub/dir_repair.c | 567 +++++++++++++++++- fs/xfs/scrub/findparent.c | 10 fs/xfs/scrub/findparent.h | 10 fs/xfs/scrub/inode_repair.c | 41 + fs/xfs/scrub/listxattr.c | 94 +++ fs/xfs/scrub/listxattr.h | 13 fs/xfs/scrub/nlinks.c | 71 ++ fs/xfs/scrub/nlinks.h | 3 fs/xfs/scrub/nlinks_repair.c | 2 fs/xfs/scrub/orphanage.c | 42 + fs/xfs/scrub/orphanage.h | 3 fs/xfs/scrub/parent.c | 695 ++++++++++++++++++++++ fs/xfs/scrub/parent_repair.c | 1316 +++++++++++++++++++++++++++++++++++++++++- fs/xfs/scrub/readdir.c | 57 ++ fs/xfs/scrub/readdir.h | 3 fs/xfs/scrub/scrub.c | 2 fs/xfs/scrub/trace.c | 1 fs/xfs/scrub/trace.h | 217 +++++++ 32 files changed, 4113 insertions(+), 108 deletions(-)