]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xfs: finish dfops on every insert range shift iteration
authorChandan Babu R <chandan.babu@oracle.com>
Mon, 31 Oct 2022 04:53:52 +0000 (10:23 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 14:56:54 +0000 (23:56 +0900)
From: Brian Foster <bfoster@redhat.com>

commit edc97d6e07ff0df40e4d052cca7c7cde3d12bf4a upstream.

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: 02ed3ac858a9 ("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>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_bmap_util.c

index 5b211cb8b57983b9fced48d2dbaf076a18df79a8..12c12c2ef2416580aa6b8b09b910000e18787afd 100644 (file)
@@ -1340,7 +1340,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;