Hi all, Orphaned files are defined to be files with nonzero ondisk link count but no observable parent directory. This series enables online repair to reparent orphaned files into the filesystem directory tree, and wires up this reparenting ability into the directory, file link count, and parent pointer repair functions. This is how we fix files with positive link count that are not reachable through the directory tree. This patch will also create the orphanage directory (lost+found) if it is not present. In contrast to xfs_repair, we follow e2fsck in creating the lost+found without group or other-owner access to avoid accidental disclosure of files that were previously hidden by an 0700 directory. That's silly security, but people have been known to do it. 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-orphanage --- fs/xfs/Makefile | 1 fs/xfs/scrub/dir_repair.c | 101 ++++++++ fs/xfs/scrub/nlinks.c | 11 + fs/xfs/scrub/nlinks.h | 6 + fs/xfs/scrub/nlinks_repair.c | 250 ++++++++++++++++++++- fs/xfs/scrub/orphanage.c | 504 ++++++++++++++++++++++++++++++++++++++++++ fs/xfs/scrub/orphanage.h | 79 +++++++ fs/xfs/scrub/parent.c | 10 + fs/xfs/scrub/parent_repair.c | 92 ++++++++ fs/xfs/scrub/repair.h | 4 fs/xfs/scrub/scrub.c | 2 fs/xfs/scrub/scrub.h | 4 fs/xfs/scrub/trace.c | 1 fs/xfs/scrub/trace.h | 59 +++++ fs/xfs/xfs_inode.c | 6 - fs/xfs/xfs_inode.h | 1 16 files changed, 1119 insertions(+), 12 deletions(-) create mode 100644 fs/xfs/scrub/orphanage.c create mode 100644 fs/xfs/scrub/orphanage.h