OSDN Git Service

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)
commit490d451fa5188975c21246f7f8f4914cd3f2d6f2
tree334d0a26f447c2e594aa18fe5336487e4801bf9e
parent494dba7b276e12bc3f6ff2b9b584b6e9f693af45
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