]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit - repair/dinode.c
xfs_repair: fix handling of data blocks colliding with existing metadata
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 28 Sep 2020 21:35:37 +0000 (17:35 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Mon, 28 Sep 2020 21:35:37 +0000 (17:35 -0400)
commit36669577e82c51347df3565317416e2ab77f204f
tree9b46cbcacae76686e06dd1199848d4b7f7b72fd8
parente487b5572476cca3f4a3e143757822b70138635e
xfs_repair: fix handling of data blocks colliding with existing metadata

Prior to commit a406779bc8d8, any blocks in a data fork extent that
collided with existing blocks would cause the entire data fork extent to
be rejected.  Unfortunately, the patch to add data block sharing support
suppressed checking for any collision, including metadata.  What we
really wanted to do here during a check_dups==1 scan is to is check for
specific collisions and without updating the block mapping data.

So, move the check_dups test after the for-switch construction.  This
re-enables detecting collisions between data fork blocks and a
previously scanned chunk of metadata, and improves the specificity of
the error message that results.

This was found by fuzzing recs[2].free=zeroes in xfs/364, though this
patch alone does not solve all the problems that scenario presents.

Fixes: a406779bc8d8 ("xfs_repair: handle multiple owners of data blocks")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
repair/dinode.c