From b37c1e4e9af795ac31ddc992b0461182c45705dc Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 14 Jan 2026 07:53:28 +0100 Subject: [PATCH] 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 Reviewed-by: Darrick J. Wong Reviewed-by: Damien Le Moal Signed-off-by: Carlos Maiolino --- fs/xfs/xfs_zone_alloc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c index 538236ea24663..d127f122d6cf2 100644 --- a/fs/xfs/xfs_zone_alloc.c +++ b/fs/xfs/xfs_zone_alloc.c @@ -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); -- 2.47.3