Hi all, One missing piece of functionality in the inode record repair code is figuring out what to do with a file whose mode is so corrupt that we cannot tell us the type of the file. Originally this was done by guessing the mode from the ondisk inode contents, but Christoph didn't like that because it read from data fork block 0, which could be user controlled data. Therefore, I've replaced all that with a directory scanner that looks for any dirents that point to the file with the garbage mode. If so, the ftype in the dirent will tell us exactly what mode to set on the file. Since users cannot directly write to the ftype field of a dirent, this should be safe. 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=repair-inode-mode xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-inode-mode --- Commits in this patchset: * xfs: create a static name for the dot entry too * xfs: create a predicate to determine if two xfs_names are the same * xfs: create a macro for decoding ftypes in tracepoints * xfs: repair file modes by scanning for a dirent pointing to us --- fs/xfs/libxfs/xfs_da_format.h | 11 ++ fs/xfs/libxfs/xfs_dir2.c | 6 + fs/xfs/libxfs/xfs_dir2.h | 13 ++ fs/xfs/scrub/dir.c | 4 - fs/xfs/scrub/inode_repair.c | 236 ++++++++++++++++++++++++++++++++++++++++- fs/xfs/scrub/iscan.c | 29 +++++ fs/xfs/scrub/iscan.h | 3 + fs/xfs/scrub/trace.c | 1 fs/xfs/scrub/trace.h | 49 +++++++++ 9 files changed, 344 insertions(+), 8 deletions(-)