This is a note to let you know that I've just added the patch titled xfs: finish dfops on every insert range shift iteration to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-finish-dfops-on-every-insert-range-shift-iteration.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Mon Oct 31 08:07:17 AM CET 2022 From: Chandan Babu R <chandan.babu@xxxxxxxxxx> Date: Mon, 31 Oct 2022 10:23:52 +0530 Subject: xfs: finish dfops on every insert range shift iteration To: gregkh@xxxxxxxxxxxxxxxxxxx Cc: sashal@xxxxxxxxxx, mcgrof@xxxxxxxxxx, linux-xfs@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, djwong@xxxxxxxxxx, chandan.babu@xxxxxxxxxx, amir73il@xxxxxxxxx, leah.rumancik@xxxxxxxxx Message-ID: <20221031045354.183020-2-chandan.babu@xxxxxxxxxx> From: Chandan Babu R <chandan.babu@xxxxxxxxxx> From: Brian Foster <bfoster@xxxxxxxxxx> commit 9c516e0e4554e8f26ab73d46cbc789d7d8db664d 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: dd87f87d87fa ("xfs: rework insert range into an atomic operation") Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx> Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/xfs/xfs_bmap_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -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; Patches currently in stable-queue which might be from chandan.babu@xxxxxxxxxx are queue-5.4/xfs-finish-dfops-on-every-insert-range-shift-iteration.patch queue-5.4/xfs-force-the-log-after-remapping-a-synchronous-writes-file.patch queue-5.4/xfs-clear-xfs_dq_freeing-if-we-can-t-lock-the-dquot-buffer-to-flush.patch