Darrick J. Wong 302436c27c xfs: fix an inode lookup race in xchk_get_inode
In commit d658e, we tried to improve the robustnes of xchk_get_inode in
the face of EINVAL returns from iget by calling xfs_imap to see if the
inobt itself thinks that the inode is allocated.  Unfortunately, that
commit didn't consider the possibility that the inode gets allocated
after iget but before imap.  In this case, the imap call will succeed,
but we turn that into a corruption error and tell userspace the inode is
corrupt.

Avoid this false corruption report by grabbing the AGI header and
retrying the iget before calling imap.  If the iget succeeds, we can
proceed with the usual scrub-by-handle code.  Fix all the incorrect
comments too, since unreadable/corrupt inodes no longer result in EINVAL
returns.

Fixes: d658e72b4a09 ("xfs: distinguish between corrupt inode and invalid inum in xfs_scrub_get_inode")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
2023-04-11 19:00:21 -07:00
..
2022-01-15 16:30:29 +02:00
2021-10-22 16:00:31 -07:00
2023-01-19 09:24:28 +01:00
2022-07-22 10:58:39 -07:00
2023-02-28 16:08:30 -08:00
2023-02-20 11:53:11 -08:00
2022-10-10 20:32:10 -07:00
2022-05-11 17:01:22 +10:00
2021-08-19 10:07:14 -07:00
2023-02-10 09:06:06 -08:00