diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-07-12 12:58:47 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-07-15 09:58:41 -0700 |
commit | da062d16a897c0759ae907e786bc0bea950c0c9d (patch) | |
tree | e42f7bea0af7ee0b2103d34427afc23cfbbf4987 /fs/xfs/libxfs/xfs_ialloc.h | |
parent | e73f0f0ee7541171d89f2e2491130c7771ba58d3 (diff) | |
download | linux-da062d16a897c0759ae907e786bc0bea950c0c9d.tar.gz linux-da062d16a897c0759ae907e786bc0bea950c0c9d.tar.bz2 linux-da062d16a897c0759ae907e786bc0bea950c0c9d.zip |
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>
Diffstat (limited to 'fs/xfs/libxfs/xfs_ialloc.h')
-rw-r--r-- | fs/xfs/libxfs/xfs_ialloc.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_ialloc.h b/fs/xfs/libxfs/xfs_ialloc.h index 9df7c80408ff..9a2112b4ad5e 100644 --- a/fs/xfs/libxfs/xfs_ialloc.h +++ b/fs/xfs/libxfs/xfs_ialloc.h @@ -122,4 +122,7 @@ int xfs_ialloc_cluster_alignment(struct xfs_mount *mp); void xfs_ialloc_setup_geometry(struct xfs_mount *mp); xfs_ino_t xfs_ialloc_calc_rootino(struct xfs_mount *mp, int sunit); +int xfs_ialloc_check_shrink(struct xfs_trans *tp, xfs_agnumber_t agno, + struct xfs_buf *agibp, xfs_agblock_t new_length); + #endif /* __XFS_IALLOC_H__ */ |