From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 859E9C4332F for ; Wed, 2 Nov 2022 03:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbiKBDWv (ORCPT ); Tue, 1 Nov 2022 23:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230500AbiKBDWa (ORCPT ); Tue, 1 Nov 2022 23:22:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D3626106 for ; Tue, 1 Nov 2022 20:22:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E9B6B617CB for ; Wed, 2 Nov 2022 03:22:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86D66C433D6; Wed, 2 Nov 2022 03:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667359338; bh=TduVsrTV8c+1EYQixNCG5YRaqqS1JFu/7n8YVoT4xx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MxpFlgCvD4q6p3O5wM+MQLfv5WjTEa/Pq2TAaD7PddiTyTJ0kHjbRRwXL2z+BAWmG 1QnDXfn/hWtB/PhCKsEQPgJiIY2er5wQgI36EPwwkM3pXs9/ZOtGPeHjPyhRllN/S+ uzEOrGO5WiDUm+jMkZUNNPTqdvHCqrtBVMiqW3ps= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Brian Foster , "Darrick J. Wong" , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 23/64] xfs: finish dfops on every insert range shift iteration Date: Wed, 2 Nov 2022 03:33:49 +0100 Message-Id: <20221102022052.558387236@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221102022051.821538553@linuxfoundation.org> References: <20221102022051.821538553@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chandan Babu R From: Brian Foster 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 Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman --- 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;