Commit 014695c0 authored by Gao Xiang's avatar Gao Xiang Committed by Darrick J. Wong

xfs: update lazy sb counters immediately for resizefs

sb_fdblocks will be updated lazily if lazysbcount is enabled,
therefore when shrinking the filesystem sb_fdblocks could be
larger than sb_dblocks and xfs_validate_sb_write() would fail.

Even for growfs case, it'd be better to update lazy sb counters
immediately to reflect the real sb counters.
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Signed-off-by: default avatarGao Xiang <hsiangkao@redhat.com>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent f9dd7ba4
...@@ -128,6 +128,15 @@ xfs_growfs_data_private( ...@@ -128,6 +128,15 @@ xfs_growfs_data_private(
nb - mp->m_sb.sb_dblocks); nb - mp->m_sb.sb_dblocks);
if (id.nfree) if (id.nfree)
xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, id.nfree); xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, id.nfree);
/*
* Sync sb counters now to reflect the updated values. This is
* particularly important for shrink because the write verifier
* will fail if sb_fdblocks is ever larger than sb_dblocks.
*/
if (xfs_sb_version_haslazysbcount(&mp->m_sb))
xfs_log_sb(tp);
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
error = xfs_trans_commit(tp); error = xfs_trans_commit(tp);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment