xfs_repair: synthesize incore inode tree records when required
On a filesystem with 64k fsblock size, xfs/093 fails with the following:
Phase 3 - for each AG...
- scan and clear agi unlinked lists...
found inodes not in the inode allocation tree
found inodes not in the inode allocation tree
- process known inodes and perform inode discovery...
- agno = 0
xfs_repair: dino_chunks.c:1166: process_aginodes: Assertion `num_inos == igeo->ialloc_inos' failed.
./common/xfs: line 392: 361225 Aborted (core dumped) $XFS_REPAIR_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
In this situation, the inode size is 512b, which means that two inobt
records map to a single fs block. However, the inobt walk didn't find
the second record, so it didn't create a second incore ino_tree_node_t
object. The assertion trips, and we fail to repair the filesystem.
To fix this, synthesize incore inode records when we know that they must
exist. Mark the inodes as in use so that they will not be purged from
parent directories or moved to lost+found if the directory tree is also
compromised.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>