]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: fix inode_cluster_size rounding mayhem
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 28 Aug 2019 16:08:08 +0000 (12:08 -0400)
committerEric Sandeen <sandeen@redhat.com>
Wed, 28 Aug 2019 16:08:08 +0000 (12:08 -0400)
commitf87807262c1acc10b0a959b9060a755f9e768567
tree6fb835c69a83b4ff609c7bacdfa5c935b96f71ac
parent3a05ab227ebd5982f910f752692c87005c7b3ad3
xfs: fix inode_cluster_size rounding mayhem

Source kernel commit: 490d451fa5188975c21246f7f8f4914cd3f2d6f2

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>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_format.h
libxfs/xfs_ialloc.c
libxfs/xfs_trans_resv.c