Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3346570pxv; Sun, 4 Jul 2021 16:11:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9A6Y2Wqat4bkdKzo4efzr5dfRPUi2+CMuCS12LYfd9HiF8Ea/kFOEaxmKL5tgYC1y0lPy X-Received: by 2002:a92:c085:: with SMTP id h5mr8057427ile.61.1625440280568; Sun, 04 Jul 2021 16:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625440280; cv=none; d=google.com; s=arc-20160816; b=JuFGgojemOL9ju9R3FO5nPEoeM58J1d40ATel3xh8KFISl/59hfhXQWw/iE8YGV7lv AfBWnMxuU7I7sCBlTS0QYikxLNDoLWq1o4D6yAAgSMzKi0E/Xmao647p7cbgi94pEB1H 4beqFUDgeQDZlaDDHsfhoiDMifWJBGQuXcr6GMOrVv5OExIMW+3AqlLBQVh6cblCcqsS 1RYo5sdmxa6kfLVCZfffuUz6bO4oEBR7l/t3FLZk1AeWxYHvii2KFV0KPbBfWQBQ4IO1 7iS6k+QtstxuPKU5RrwGEHLXV5DuJ6xIeSX0lpb5bV99DTO6Yhm/Uc6hnLcqbU+jFBuL y9zQ== 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=2we6PXI6thJWwZr49DMmJD+mB5W30Uu+9tD7KgWJw4g=; b=VvhsZvE7mup36yYj0dlCQW9dna5DD0WQbLtgsnJh8+ZarUN0QWJrG91Ezh4rtMrieH d57LNDzUZgGSPxVyDI74R03bnUOHRCCVQKo53UIlhcwebonKSMD4jyj5sppxbRfUbC+s qBKMMdZfMSx/XQyatxY63s86VFbdJf6sizGM2vSkAc1kW12aWuuvuK6WjdOpSYY9PfGR Taq4RlaexiM8p8EgA3cOoWRFN0ngudjlb2GLoUOemioUUm2founWBhxHqw0NpnEN8DoB dWL+z9thbUw1xai0sx9tq7V6c9p/cLgkY8tzHgktIlUe9q2hHRdQaKVf0VA8eyUmP8ST 3L9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LVTsXBgg; 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 v5si12272437jan.103.2021.07.04.16.11.09; Sun, 04 Jul 2021 16:11:20 -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=LVTsXBgg; 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 S231675AbhGDXMR (ORCPT + 99 others); Sun, 4 Jul 2021 19:12:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:50832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232434AbhGDXKW (ORCPT ); Sun, 4 Jul 2021 19:10:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A53C561474; Sun, 4 Jul 2021 23:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625440066; bh=GeLV7MXhGJlzEIXUxEdmRAGvCyJSUmieVB1v6u/xxqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LVTsXBgg3KwfRNDdOIUY5/MzKm21HxC0hhsB6lZ/BRnUrSEh6R6AY/WRFtATjjWUs R9MI9Wzv5hxKs0+OcmyIZXz94ET+O8O92I6Jh2fsnFqM8DQdAiumonB3TJ9fku61jA lBYCL5P4ZuELAap0wiAnuO1HmVQeh85u2Mc0kAfB3huBnyrZaQESfjWmjnHt78lQur mHKMml7EYfzWW7dtp3P4dI96vOS2UCy31Zx39U5r/Ha+fUcaIwIZcEYkd7JJfsfVCz vYOBqEA+5Jrk1lp/QfUx7epgY3923fWh+hs7avy94GwgTXxWhvu+ipgRvNJj1YLzvE rhQkHblHW44Gg== 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.12 67/80] btrfs: abort transaction if we fail to update the delayed inode Date: Sun, 4 Jul 2021 19:06:03 -0400 Message-Id: <20210704230616.1489200-67-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230616.1489200-1-sashal@kernel.org> References: <20210704230616.1489200-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 2f73846d712f..55dad12a5ce0 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -1066,6 +1066,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