diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-11-03 20:18:59 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-11-05 13:38:34 -0800 |
commit | 5dab2daa8aa1a127523f2babaf9611d91c28acea (patch) | |
tree | 479dd5ea1068f9d0c4c6f0c81d1b490073af6040 /fs/xfs/scrub/inode.c | |
parent | aec2eb7da8f777998164a8ce4e38b84fd0136f97 (diff) |
xfs: fix di_metatype field of inodes that won't load
Make sure that the di_metatype field is at least set plausibly so that
later scrubbers could set the real type.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/scrub/inode.c')
-rw-r--r-- | fs/xfs/scrub/inode.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/xfs/scrub/inode.c b/fs/xfs/scrub/inode.c index ac5c56416533..25ee66e7649d 100644 --- a/fs/xfs/scrub/inode.c +++ b/fs/xfs/scrub/inode.c @@ -443,8 +443,13 @@ xchk_dinode( break; case 2: case 3: - if (!xfs_dinode_is_metadir(dip) && dip->di_metatype) - xchk_ino_set_corrupt(sc, ino); + if (xfs_dinode_is_metadir(dip)) { + if (be16_to_cpu(dip->di_metatype) >= XFS_METAFILE_MAX) + xchk_ino_set_corrupt(sc, ino); + } else { + if (dip->di_metatype != 0) + xchk_ino_set_corrupt(sc, ino); + } if (dip->di_mode == 0 && sc->ip) xchk_ino_set_corrupt(sc, ino); |