]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: check for sparse inode clusters that cross new EOAG when shrinking
authorDarrick J. Wong <djwong@kernel.org>
Mon, 12 Jul 2021 19:58:47 +0000 (12:58 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 15 Jul 2021 16:58:41 +0000 (09:58 -0700)
commit9e4175fdf9c0fcd931b7a43c1f09c322e4e50e3f
treee42f7bea0af7ee0b2103d34427afc23cfbbf4987
parentb1b49cbcf8bd66059ed6f80c573a7ff83991d8ef
xfs: check for sparse inode clusters that cross new EOAG when shrinking

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>
fs/xfs/libxfs/xfs_ag.c
fs/xfs/libxfs/xfs_ialloc.c
fs/xfs/libxfs/xfs_ialloc.h