Skip to content

Commit

Permalink
xfs: finish dfops on every insert range shift iteration
Browse files Browse the repository at this point in the history
The recent change to make insert range an atomic operation used the
incorrect transaction rolling mechanism. The explicit transaction
roll does not finish deferred operations. This means that intents
for rmapbt updates caused by extent shifts are not logged until the
final transaction commits. Thus if a crash occurs during an insert
range, log recovery might leave the rmapbt in an inconsistent state.
This was discovered by repeated runs of generic/455.

Update insert range to finish dfops on every shift iteration. This
is similar to collapse range and ensures that intents are logged
with the transactions that make associated changes.

Fixes: dd87f87 ("xfs: rework insert range into an atomic operation")
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  • Loading branch information
Brian Foster authored and Darrick J. Wong committed Aug 26, 2020
1 parent 9123e3a commit 9c516e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/xfs/xfs_bmap_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ xfs_insert_file_space(
goto out_trans_cancel;

do {
error = xfs_trans_roll_inode(&tp, ip);
error = xfs_defer_finish(&tp);
if (error)
goto out_trans_cancel;

Expand Down

0 comments on commit 9c516e0

Please sign in to comment.