]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: detect and fix bad summary counts at mount
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 19 Jul 2018 19:29:13 +0000 (12:29 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 23 Jul 2018 16:08:01 +0000 (09:08 -0700)
commit098f8e1a07842d1c68cfa7df4bef654735c3ece6
tree0154cfaeb88ee991396b590707293c0d3de4befa
parent4a2e0da54aab49ed82a3f2b015227130bfcb19fa
xfs: detect and fix bad summary counts at mount

Filippo Giunchedi complained that xfs doesn't even perform basic sanity
checks of the fs summary counters at mount time.  Therefore, recalculate
the summary counters from the AGFs after log recovery if the counts were
bad (or we had to recover the fs).  Enhance the recalculation routine to
fail the mount entirely if the new values are also obviously incorrect.

We use a mount state flag to record the "bad summary count" state so
that the (subsequent) online fsck patches can detect subtlely incorrect
counts and set the flag; clear it userspace asks for a repair; or force
a recalculation at the next mount if nobody fixes it by unmount time.

Reported-by: Filippo Giunchedi <fgiunchedi@wikimedia.org>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_sb.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.h