]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: check for sparse inode clusters that cross new EOAG when shrinking
authorDarrick J. Wong <djwong@kernel.org>
Fri, 15 Oct 2021 20:28:27 +0000 (16:28 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 15 Oct 2021 20:28:27 +0000 (16:28 -0400)
commit23435e3c60312728f72af22d1caf21c3b46d33b1
treed98ef034302e375cbb57adf0f12e3444762d1a4b
parent8b1a83264660fd35d66d8d807f37266101027fb0
xfs: check for sparse inode clusters that cross new EOAG when shrinking

Source kernel commit: da062d16a897c0759ae907e786bc0bea950c0c9d

While running xfs/168, I noticed occasional write verifier shutdowns
involving inodes at the very end of the filesystem.  Existing inode
btree validation code checks that all inode clusters are fully contained
within the filesystem.

However, due to inadequate checking in the fs shrink code, it's possible
that there could be a sparse inode cluster at the end of the filesystem
where the upper inodes of the cluster are marked as holes and the
corresponding blocks are free.  In this case, the last blocks in the AG
are listed in the bnobt.  This enables the shrink to proceed but results
in a filesystem that trips the inode verifiers.  Fix this by disallowing
the shrink.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_ag.c
libxfs/xfs_ialloc.c
libxfs/xfs_ialloc.h