]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit - repair/phase5.c
xfs_repair: add AG btree rmaps into the filesystem after syncing sb
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 9 Sep 2019 19:37:08 +0000 (15:37 -0400)
committerEric Sandeen <sandeen@redhat.com>
Mon, 9 Sep 2019 19:37:08 +0000 (15:37 -0400)
commitac8b6c3808652720abf42e40df27a03f49ee0a4b
tree2bc365682f897dd8b14cd063771fec91936fa943
parent904a5020dbcb15281c8bdc229cde83da65161984
xfs_repair: add AG btree rmaps into the filesystem after syncing sb

In rmap_store_ag_btree_rec(), we try to reserve 16 blocks to handle
adding all the AG btree rmaps to the rmap record.  Unfortunately, at
that point in phase5 we haven't yet reinitialied sb_fdblocks, so
reserving blocks can fail if repair reconstructed the primary sb from a
secondary sb.  Even if the function succeeds, this still leads to
incorrect fdblocks because phase 5 resets sb_fdblocks after running the
rmap transactions.

To avoid all this, move the rmap_store_ag_btree_rec call to after the sb
has been reset.  xfs/350 was helpful in finding cases where xfs_repair
errored out while repairing the filesystem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
repair/phase5.c