• Darrick J. Wong's avatar
    xfs: detect and fix bad summary counts at mount · 2e9e6481
    Darrick J. Wong authored
    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: default avatarFilippo Giunchedi <fgiunchedi@wikimedia.org>
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    2e9e6481
xfs_mount.c 36 KB