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 CD093E95A89 for ; Sun, 8 Oct 2023 00:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344280AbjJHAyp (ORCPT ); Sat, 7 Oct 2023 20:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344286AbjJHAym (ORCPT ); Sat, 7 Oct 2023 20:54:42 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 791B0D5E; Sat, 7 Oct 2023 17:50:17 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 755D1C433A9; Sun, 8 Oct 2023 00:50:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696726214; bh=DP1pCqvcmm+ff4PiuZGlAzsuv/HvH1tUu+70pVGrOh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ouWSalPHkqCqjkncFUCLZvWwdoF3LgGao6BV9a0i4PwY0g35/8Fn0viEr1ErPTn4Q AD5N7bbBXo43GtCIs4tUdjaZPDh4ba5Cz8s+/+suT3Db61PsvAJeeUWFj8og2d5SKI 8d1TmJoTe3KWBdfHweea+gR3wjA3hDTdNC3Are+JXfrPRFgvAQHTNE4HzTXuSqMfgS tubzP9QUVkxCqDlcWW2l/9mVzlxLHDaS+7hgnaWKYjTrf/+PqWdP3FTKKs4N/QCXqF DT8FZ9lr/HwSf287cpZqHkQ7YWtRZuD3YZBDelzp6O+1HrUqBwh1QCAEFtcwcs/sAS VPh3UoV2PNwnw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Filipe Manana , Josef Bacik , David Sterba , Sasha Levin , clm@fb.com, linux-btrfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 2/8] btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1 Date: Sat, 7 Oct 2023 20:50:03 -0400 Message-Id: <20231008005009.3768314-2-sashal@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008005009.3768314-1-sashal@kernel.org> References: <20231008005009.3768314-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.10.197 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Filipe Manana [ Upstream commit 1bf76df3fee56d6637718e267f7c34ed70d0c7dc ] When running a delayed tree reference, if we find a ref count different from 1, we return -EIO. This isn't an IO error, as it indicates either a bug in the delayed refs code or a memory corruption, so change the error code from -EIO to -EUCLEAN. Also tag the branch as 'unlikely' as this is not expected to ever happen, and change the error message to print the tree block's bytenr without the parenthesis (and there was a missing space between the 'block' word and the opening parenthesis), for consistency as that's the style we used everywhere else. Reviewed-by: Josef Bacik Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/extent-tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 4d2f25ebe3048..8f62e171053ba 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -1641,12 +1641,12 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans, parent = ref->parent; ref_root = ref->root; - if (node->ref_mod != 1) { + if (unlikely(node->ref_mod != 1)) { btrfs_err(trans->fs_info, - "btree block(%llu) has %d references rather than 1: action %d ref_root %llu parent %llu", + "btree block %llu has %d references rather than 1: action %d ref_root %llu parent %llu", node->bytenr, node->ref_mod, node->action, ref_root, parent); - return -EIO; + return -EUCLEAN; } if (node->action == BTRFS_ADD_DELAYED_REF && insert_reserved) { BUG_ON(!extent_op || !extent_op->update_flags); -- 2.40.1