• D
    xfs: don't commit sunit/swidth updates to disk if that would cause repair failures · 13eaec4b
    Darrick J. Wong 提交于
    Alex Lyakas reported[1] that mounting an xfs filesystem with new sunit
    and swidth values could cause xfs_repair to fail loudly.  The problem
    here is that repair calculates the where mkfs should have allocated the
    root inode, based on the superblock geometry.  The allocation decisions
    depend on sunit, which means that we really can't go updating sunit if
    it would lead to a subsequent repair failure on an otherwise correct
    filesystem.
    
    Port from xfs_repair some code that computes the location of the root
    inode and teach mount to skip the ondisk update if it would cause
    problems for repair.  Along the way we'll update the documentation,
    provide a function for computing the minimum AGFL size instead of
    open-coding it, and cut down some indenting in the mount code.
    
    Note that we allow the mount to proceed (and new allocations will
    reflect this new geometry) because we've never screened this kind of
    thing before.  We'll have to wait for a new future incompat feature to
    enforce correct behavior, alas.
    
    Note that the geometry reporting always uses the superblock values, not
    the incore ones, so that is what xfs_info and xfs_growfs will report.
    
    [1] https://lore.kernel.org/linux-xfs/20191125130744.GA44777@bfoster/T/#m00f9594b511e076e2fcdd489d78bc30216d72a7dReported-by: NAlex Lyakas <alex@zadara.com>
    Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: NBrian Foster <bfoster@redhat.com>
    13eaec4b
xfs_ialloc.c 80.1 KB