xfs: check that used blocks are smaller than the write pointer

Any used block must have been written, this reject used blocks > write
pointer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Christoph Hellwig 2026-01-14 07:53:28 +01:00 committed by Carlos Maiolino
parent 19c5b6051e
commit b37c1e4e9a

View File

@ -1033,6 +1033,13 @@ xfs_init_zone(
return -EFSCORRUPTED;
}
if (used > write_pointer) {
xfs_warn(mp,
"zone %u has used counter (0x%x) larger than write pointer (0x%x).",
rtg_rgno(rtg), used, write_pointer);
return -EFSCORRUPTED;
}
if (write_pointer == 0 && used != 0) {
xfs_warn(mp, "empty zone %u has non-zero used counter (0x%x).",
rtg_rgno(rtg), used);