Commit a440a28d authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: fix off-by-one error in fsmap's end_daddr usage



In commit ca6448ae, we created an "end_daddr" variable to fix
fsmap reporting when the end of the range requested falls in the middle
of an unknown (aka free on the rmapbt) region.  Unfortunately, I didn't
notice that the the code sets end_daddr to the last sector of the device
but then uses that quantity to compute the length of the synthesized
mapping.

Zizhi Wo later observed that when end_daddr isn't set, we still don't
report the last fsblock on a device because in that case (aka when
info->last is true), the info->high mapping that we pass to
xfs_getfsmap_group_helper has a startblock that points to the last
fsblock.  This is also wrong because the code uses startblock to
compute the length of the synthesized mapping.

Fix the second problem by setting end_daddr unconditionally, and fix the
first problem by setting start_daddr to one past the end of the range to
query.

Cc: <stable@vger.kernel.org> # v6.11
Fixes: ca6448ae ("xfs: Fix missing interval for missing_owner in xfs fsmap")
Signed-off-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Reported-by: default avatarZizhi Wo <wozizhi@huawei.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent f92f4749
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment