]> git.itanic.dy.fi Git - linux-stable/commit
xfs: fix brainos in the refcount scrubber's rmap fragment processor
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 9 Nov 2020 00:32:42 +0000 (16:32 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:20:27 +0000 (19:20 +0100)
commitb45f52a20879b92af2de42ed4c52d0fd72571412
tree028ca8b4f38efbdaac17fb02f46de65b0d1d6ad0
parent7cbf708b1b9a8f70065838bd32393d3db0cd2a63
xfs: fix brainos in the refcount scrubber's rmap fragment processor

[ Upstream commit 54e9b09e153842ab5adb8a460b891e11b39e9c3d ]

Fix some serious WTF in the reference count scrubber's rmap fragment
processing.  The code comment says that this loop is supposed to move
all fragment records starting at or before bno onto the worklist, but
there's no obvious reason why nr (the number of items added) should
increment starting from 1, and breaking the loop when we've added the
target number seems dubious since we could have more rmap fragments that
should have been added to the worklist.

This seems to manifest in xfs/411 when adding one to the refcount field.

Fixes: dbde19da9637 ("xfs: cross-reference the rmapbt data with the refcountbt")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/xfs/scrub/refcount.c