Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3570142pxb; Mon, 24 Jan 2022 12:28:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyypaD2J/t2PlvMFxKUE+eKs7ELBj5Lh1L9OOCZfNjtCETaRGLxoJHhRjB5gmUFTjrzXRt X-Received: by 2002:a63:81c6:: with SMTP id t189mr12996233pgd.417.1643056098020; Mon, 24 Jan 2022 12:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056098; cv=none; d=google.com; s=arc-20160816; b=RIgMxjw7mT8yljL4Znd0+8oMFDNJfD5H0cWKje6g3xuwMRPQjFodJfd39v2RM5iTCi rlNdv6AYaflA+FKy90i5cCBYYVfaTdZnvxw2+C+F3S/AcM9p+HhMPKpD/TaNDz+X6U70 /XPIEydc/WftKras96oTOkOtoY1TTX+nLJjxDizciDpG1VjJ1NCwkCMHkHGjoTc8/BVM 5kzEXmvKAwqmvUu8jX6w+lBodAbPPHRnLed+HkIbUMjljg9PSr7r2yHXQ5rCue6pVAad mtj6MV2lWJdkr7RQV2jgsTALARL3cyZJ9Xx7od1qrjSkxAKPTpp0KRapYApsO1mASSDN L/8w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=whbwsQauaweb0tDNQkx8VK9q6rYcsKjBR+5zGTBouj8=; b=dYiSnmJRBsny5kAC2LD0zQ9t0VHTZT0W2bX9xi5cSkSy3mJFuQN2BxHxNhg777VkDr 7ms1Z7Iwn1z5MoLi0oeo//loC2bHCFbhEzm8hzFgGN8yd1S6SOM/twATpXrWVMN/aI9M /aZyZiB1vfVrxc2iuTL2yLjL9zCa8GUNnhgSfjQCcfstz+vRJf6ht4JtrhimYKe4xkgv nqXC3TWiTAL7oB+ZJUAnMkk46bdiNyIDcePZq/5bmAhPeX4gAwSDiVUU2DGg8L/ZIhP7 lNJAmH53ky1a61NChHLT7DGS91WA9jc/8ktFm0eQTer/tkVJbadn/BUVeqhygXB9LrBW oiDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CEMLf2/d"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kx3si262366pjb.166.2022.01.24.12.28.05; Mon, 24 Jan 2022 12:28:18 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b="CEMLf2/d"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352560AbiAXTal (ORCPT + 99 others); Mon, 24 Jan 2022 14:30:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349837AbiAXTVY (ORCPT ); Mon, 24 Jan 2022 14:21:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DDCFC02B857; Mon, 24 Jan 2022 11:08:34 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 0B45CB811FC; Mon, 24 Jan 2022 19:08:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18BFEC340E5; Mon, 24 Jan 2022 19:08:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051311; bh=SvjvMtJ7tOmDYbJxKQfh7QYBfYnBz6AH1YssZDecAbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CEMLf2/dr4Gv3X83S2QACF1mUMiKEEyPM6iMTGOedEigFHrn2RLdLc65ehiIvRrCe VQRPj1YEhmjIkIuFsBNOr6yalOqZ8aNh1oHuOyewiU8ETxarw0A0tIuZ9pXuQrKqcg BKvDMuqKJRIDKKDtVWeU+8HkjrMziHq1aNMx7GNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 4.14 122/186] btrfs: remove BUG_ON() in find_parent_nodes() Date: Mon, 24 Jan 2022 19:43:17 +0100 Message-Id: <20220124183941.038652634@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik [ Upstream commit fcba0120edf88328524a4878d1d6f4ad39f2ec81 ] We search for an extent entry with .offset = -1, which shouldn't be a thing, but corruption happens. Add an ASSERT() for the developers, return -EUCLEAN for mortals. Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/backref.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 1cf75d1032e17..f2c2ac3343bac 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1163,7 +1163,12 @@ again: ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0); if (ret < 0) goto out; - BUG_ON(ret == 0); + if (ret == 0) { + /* This shouldn't happen, indicates a bug or fs corruption. */ + ASSERT(ret != 0); + ret = -EUCLEAN; + goto out; + } #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS if (trans && likely(trans->type != __TRANS_DUMMY) && -- 2.34.1