Darrick J. Wong 13eaec4b2a xfs: don't commit sunit/swidth updates to disk if that would cause repair failures
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/#m00f9594b511e076e2fcdd489d78bc30216d72a7d

Reported-by: Alex Lyakas <alex@zadara.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
2019-12-19 07:53:48 -08:00
..
2019-09-27 15:10:34 -07:00
2019-11-30 10:57:22 -08:00
2019-09-19 09:42:37 -07:00
2019-07-12 17:37:53 -07:00
2019-11-11 09:21:59 -05:00
\n
2019-11-30 11:16:07 -08:00
2019-12-05 13:20:11 -08:00
2019-09-19 09:42:37 -07:00
2019-09-19 09:42:37 -07:00
2019-11-18 11:04:32 +01:00
2019-12-04 19:44:11 -08:00
2019-09-19 09:42:37 -07:00
2019-12-01 14:00:59 -08:00
2019-12-02 14:46:22 -08:00
2019-11-30 10:44:49 -08:00
2019-08-07 21:51:47 -04:00
2019-10-25 14:08:24 -04:00
2019-12-05 07:59:37 -07:00
2019-12-02 14:46:22 -08:00
2019-10-14 15:04:01 -07:00
2019-09-27 17:00:27 -07:00