]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: fix inode_cluster_size rounding mayhem
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 5 Jun 2019 18:19:35 +0000 (11:19 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 12 Jun 2019 15:37:40 +0000 (08:37 -0700)
commit54eaefa545f2ff38af71e7cfdc439041d6e9ae5c
tree334d0a26f447c2e594aa18fe5336487e4801bf9e
parentaa9dd7e79d02a2e9b4fbc3c5a35afaf94315b6aa
xfs: fix inode_cluster_size rounding mayhem

inode_cluster_size is supposed to represent the size (in bytes) of an
inode cluster buffer.  We avoid having to handle multiple clusters per
filesystem block on filesystems with large blocks by openly rounding
this value up to 1 FSB when necessary.  However, we never reset
inode_cluster_size to reflect this new rounded value, which adds to the
potential for mistakes in calculating geometries.

Fix this by setting inode_cluster_size to reflect the rounded-up size if
needed, and special-case the few places in the sparse inodes code where
we actually need the smaller value to validate on-disk metadata.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/libxfs/xfs_format.h
fs/xfs/libxfs/xfs_ialloc.c
fs/xfs/libxfs/xfs_trans_resv.c
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_mount.c