summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2026-01-14 07:53:28 +0100
committerCarlos Maiolino <cem@kernel.org>2026-01-21 12:57:17 +0100
commitb37c1e4e9af795ac31ddc992b0461182c45705dc (patch)
tree216c401975315c70be76e1e6269bf92c16142128
parent19c5b6051ed62d8c4b1cf92e463c1bcf629107f4 (diff)
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>
-rw-r--r--fs/xfs/xfs_zone_alloc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
index 538236ea2466..d127f122d6cf 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);