xfs: recalculate summary counters at mount time if icount is bad
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 11 Aug 2018 00:55:56 +0000 (17:55 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 13 Aug 2018 14:58:27 +0000 (07:58 -0700)
Since the sb write verifier trips on bad icounts, we should also force a
mount time recalculation of the summary counters if the icount is bad.
This helps us avoid blowing up at freeze/unmount time when the bad
counter gets written back out.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
fs/xfs/xfs_mount.c

index 99db27d6ac8a4f25de6405d69a8952144b277847..02d15098dbee3f830101dbca3aef7cad04bb4ba8 100644 (file)
@@ -637,6 +637,7 @@ xfs_check_summary_counts(
         */
        if (XFS_LAST_UNMOUNT_WAS_CLEAN(mp) &&
            (mp->m_sb.sb_fdblocks > mp->m_sb.sb_dblocks ||
+            !xfs_verify_icount(mp, mp->m_sb.sb_icount) ||
             mp->m_sb.sb_ifree > mp->m_sb.sb_icount))
                mp->m_flags |= XFS_MOUNT_BAD_SUMMARY;