From f4cea8e84fd508c8483d0018d9a5c0e016dd29a2 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Fri, 10 Jul 2020 15:35:45 -0400 Subject: [PATCH] xfs_repair: complain about free space only seen by one btree During the free space btree walk, scan_allocbt claims in a comment that we'll catch FREE1 blocks (i.e. blocks that were seen by only one free space btree) later. This never happens, with the result that xfs_repair in dry-run mode can return 0 on a filesystem with corrupt free space btrees. Found by fuzzing xfs/358 with numrecs = middlebit (or sub). Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Eric Sandeen --- repair/phase4.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/repair/phase4.c b/repair/phase4.c index 8197db06c..a43413c74 100644 --- a/repair/phase4.c +++ b/repair/phase4.c @@ -306,6 +306,12 @@ phase4(xfs_mount_t *mp) for (j = ag_hdr_block; j < ag_end; j += blen) { bstate = get_bmap_ext(i, j, ag_end, &blen); switch (bstate) { + case XR_E_FREE1: + if (no_modify) + do_warn( + _("free space (%u,%u-%u) only seen by one free space btree\n"), + i, j, j + blen - 1); + break; case XR_E_BAD_STATE: default: do_warn( @@ -313,7 +319,6 @@ phase4(xfs_mount_t *mp) i, j); /* fall through .. */ case XR_E_UNKNOWN: - case XR_E_FREE1: case XR_E_FREE: case XR_E_INUSE: case XR_E_INUSE_FS: -- 2.47.3