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 X-Spam-Level: X-Spam-Status: No, score=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32433C07E96 for ; Sun, 4 Jul 2021 23:06:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1FA2161483 for ; Sun, 4 Jul 2021 23:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbhGDXJc (ORCPT ); Sun, 4 Jul 2021 19:09:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:46804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230312AbhGDXId (ORCPT ); Sun, 4 Jul 2021 19:08:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 930706144E; Sun, 4 Jul 2021 23:05:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439957; bh=gqGBzck34BEkVkHDOZOaqwSNwL8eNePvLSHbK4K9Jx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d+y5HaHObdcKWQ+dho+NVpXESl12Eygiv/bhJ5ViJoVd2N9ShprFI0biEU8nScHVN Jm6vawxU8+NXj1EoDIZggwuiuipWF9R0zQ/tgGaCz5Dfr1e/hv3/xyEr3Qb3ueceST 1V5u2vVAPfrSIR6I+yBffoLuxBJn0jsSuEWX1L92xgEHp2R9AYW8VMfGdBv/u6ruVG Ge9WR+AehhuDKjCMRs6U8jvIoWZ2da/7pP2kPjWz1BYqk5WcXNRBWUkBRbVRZ19gCF 5fLnP6EnMAzxOSAo30gqwLJotNZWO0PLz7d1wMgmzAczS7F/KuIhkNO60tR9kzjgxc 9jvyE0Kh6sTeg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Josef Bacik , David Sterba , Sasha Levin , linux-btrfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.13 71/85] btrfs: abort transaction if we fail to update the delayed inode Date: Sun, 4 Jul 2021 19:04:06 -0400 Message-Id: <20210704230420.1488358-71-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230420.1488358-1-sashal@kernel.org> References: <20210704230420.1488358-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik [ Upstream commit 04587ad9bef6ce9d510325b4ba9852b6129eebdb ] If we fail to update the delayed inode we need to abort the transaction, because we could leave an inode with the improper counts or some other such corruption behind. Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/delayed-inode.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 3091540fc22a..3bb8b919d2c1 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -1050,6 +1050,14 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans, btrfs_delayed_inode_release_metadata(fs_info, node, (ret < 0)); btrfs_release_delayed_inode(node); + /* + * If we fail to update the delayed inode we need to abort the + * transaction, because we could leave the inode with the improper + * counts behind. + */ + if (ret && ret != -ENOENT) + btrfs_abort_transaction(trans, ret); + return ret; search: -- 2.30.2