Skip to content

Commit 3762113

Browse files
author
Darrick J. Wong
committed
xfs: don't lose solo superblock counter update transactions
Superblock counter updates are tracked via per-transaction counters in the xfs_trans object. These changes are then turned into dirty log items in xfs_trans_apply_sb_deltas just prior to commiting the log items to the CIL. However, updating the per-transaction counter deltas do not cause XFS_TRANS_DIRTY to be set on the transaction. In other words, a pure sb counter update will be silently discarded if there are no other dirty log items attached to the transaction. This is currently not the case anywhere in the filesystem because sb counter updates always dirty at least one other metadata item, but let's not leave a logic bomb. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent a004afd commit 3762113

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/xfs/xfs_trans.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,13 @@ __xfs_trans_commit(
860860

861861
trace_xfs_trans_commit(tp, _RET_IP_);
862862

863+
/*
864+
* Commit per-transaction changes that are not already tracked through
865+
* log items. This can add dirty log items to the transaction.
866+
*/
867+
if (tp->t_flags & XFS_TRANS_SB_DIRTY)
868+
xfs_trans_apply_sb_deltas(tp);
869+
863870
error = xfs_trans_run_precommits(tp);
864871
if (error)
865872
goto out_unreserve;
@@ -890,8 +897,6 @@ __xfs_trans_commit(
890897
/*
891898
* If we need to update the superblock, then do it now.
892899
*/
893-
if (tp->t_flags & XFS_TRANS_SB_DIRTY)
894-
xfs_trans_apply_sb_deltas(tp);
895900
xfs_trans_apply_dquot_deltas(tp);
896901

897902
xlog_cil_commit(log, tp, &commit_seq, regrant);

0 commit comments

Comments
 (0)