xfs: repair inode mode by scanning dirs
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.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
* tag 'repair-inode-mode-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux:
xfs: repair file modes by scanning for a dirent pointing to us
xfs: create a macro for decoding ftypes in tracepoints
xfs: create a predicate to determine if two xfs_names are the same
xfs: create a static name for the dot entry too
xfs: iscan batching should handle unallocated inodes too
xfs: cache a bunch of inodes for repair scans
xfs: stagger the starting AG of scrub iscans to reduce contention
xfs: allow scrub to hook metadata updates in other writers
xfs: implement live inode scan for scrub
xfs: speed up xfs_iwalk_adjust_start a little bit