Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3344915pxv; Sun, 4 Jul 2021 16:08:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwOgGZMReoiBqucOOmTHHGov2cc0glDUYSt4s8drIU7eRZtrJWSQW6FxuvVM1zWl8o+Mmx X-Received: by 2002:a02:820f:: with SMTP id o15mr9491086jag.139.1625440086610; Sun, 04 Jul 2021 16:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625440086; cv=none; d=google.com; s=arc-20160816; b=DQAug1EB5ThFI5ZyF5S67zZ9MUrhE/wE0ojz/g46YbbBhKAxq+oIe+uDhWoHgvXWY7 0ejSVlZWtjc/xMl6CfcXTL38AMW9lcJxULyFgUPnHPrMYn3063kczaGfLpvdoOYHgVfJ pHfNWQ9RE2n44xpIWrHi0x5Ad4JqUvkn2mXaOhscd9tIUeOUxWd5wFni+7idtezedxHX fZqogILNJ9nvd1dZAanqTtiHSmOfrlp2bCh68+LWZh/sNsi2qtId/WRHUjPFwnTgekZn gqkVK+nrbNwDr8JYSn3iaLuTT3tiNPQd1izNuteKUUVXlaVPwIoZowxNs6Bbj+sFIFZA YUFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FTI9lzhk04gUNZN620tVPc0n/uhHbYJgdlCp6hOdinU=; b=tb3ft6efV6ZS05garYA1P3/BK1T9ML9E2m6/XPvTgtCi2AoTT8i4ofa/CrzXOV4lhf wlQo1+oZEaQkA36zG5CrslV2iJARtMvrJ6kwsXgVQnCsWC7e6B0c69TE8gqM1JiNW9v9 PTh+XQyhEpn/66k6fJcdSWvRj9MuNdWr5eOTDEC5ObyLVzQ0DHUSphOpTJq2LrLvup+e JzNpMp1T4fCDJTnJLFI6jJ5rhnagEJo5bF51TGdBW+BrD5vqB3U6EJ+fzO7OJBKdscW9 2O5HXj2qnvfAWWcLO1GGdiabsT8v4h6/hGgnuYbtlAIi/o97gdBlLEvXyJ7LbkYVVA/V H+Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d+y5HaHO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c12si12314743iol.103.2021.07.04.16.07.54; Sun, 04 Jul 2021 16:08:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d+y5HaHO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbhGDXJb (ORCPT + 99 others); Sun, 4 Jul 2021 19:09:31 -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