diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-07-26 20:10:42 +0300 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-07-31 23:18:09 +0300 |
commit | 69775fd15dc78e0547af45fb3e375d5423cb21b1 (patch) | |
tree | 506226a42d76eb99d51e5686f8205d38aa5f0deb /fs/xfs/libxfs/xfs_sb.c | |
parent | 8756a5af18191a471e670cc577aea60b652fea4c (diff) | |
download | linux-69775fd15dc78e0547af45fb3e375d5423cb21b1.tar.xz |
xfs: verify icount in superblock write
Add a helper predicate to check the inode count for sanity, then use it
in the superblock write verifier to inspect sb_icount.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_sb.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_sb.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c index 3d29f4a5242f..05e7ed1b8022 100644 --- a/fs/xfs/libxfs/xfs_sb.c +++ b/fs/xfs/libxfs/xfs_sb.c @@ -154,9 +154,10 @@ xfs_validate_sb_write( * Carry out additional sb summary counter sanity checks when we write * the superblock. We skip this in the read validator because there * could be newer superblocks in the log and if the values are garbage - * we'll recalculate them at the end of log mount. + * even after replay we'll recalculate them at the end of log mount. */ if (sbp->sb_fdblocks > sbp->sb_dblocks || + !xfs_verify_icount(mp, sbp->sb_icount) || sbp->sb_ifree > sbp->sb_icount) { xfs_warn(mp, "SB summary counter sanity check failed"); return -EFSCORRUPTED; |