Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3547805pxb; Mon, 24 Jan 2022 11:57:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBBcpjvVd/GXum2IK2svw3+N4yjaArQ622y7dGCYEOFiXC3Ws1zAiv/GyXBd9yBvWxH2cl X-Received: by 2002:a63:1759:: with SMTP id 25mr12998117pgx.209.1643054267596; Mon, 24 Jan 2022 11:57:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054267; cv=none; d=google.com; s=arc-20160816; b=yrKy/3SOKzaJyzTsOBAErVnYeEQE58Ix7VMsSrd+KtH8/CDXlEh8xoEq9lC8szynZa QcHWkzt95lX+Q/9xAsA6iCzoZmRokjaDAFjw94QLObdFrCwqXb9lEJxP3iYNnMjwMR/X DLhui3IXBi4iPQYYUKHmlVn56nl2jO7QzFWAjvAIP2lIhz4pZjgmmKIPlnW+nC0rfMOB f8ZrlAoPYhqLlgQS2ptNCnLuD2NUej7ttR2WiHRQLSjSt/7GDiKti+CS6NSAV353e8/J lhejp+9O+HBkpK17oUgo3oDmcrGqeYhZ5J/dq7sqSf69w9jSY2AfM8BaegnnPz76NL6L Jy6Q== 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=ewIwKz4i9fW89WKqACSicmZ4V3tWW0BMChlHejKJ+cE=; b=GrN1kl9Etb9Wu+wqnCJ6dxVM0H60O5qQaQOPLNGGLsxvbX/3Ul1V2TepQM/2eOeqzz 2/fmrjth66vxvG/mHCMAez8t2K2vhEeb1oaj1RQoSLrgxuN3grQ6EHYvjyDNZmcHNIaB Z/Tf2tEr4NxlQAba9X5xpnJxLKHyG7nUEURh0bwg9fA9Pf4phcNf0rfO24nX/z8lVz2M baoGMiVHo+Ht6M867xBacGRwNQF/8O6Fy97BY18B8gvEOSSDvzqiSwO4WYRlhaksUQC6 c2i4j4dKxPx7fY61J15L2qJszML1PMCorBCr+0PQ+/xtIpXyBIpnIz8jejaJ9ojNx0qa 3rSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q3pjVM0P; 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 l12si2109577pls.140.2022.01.24.11.57.32; Mon, 24 Jan 2022 11:57:47 -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=Q3pjVM0P; 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 S1344106AbiAXSxa (ORCPT + 99 others); Mon, 24 Jan 2022 13:53:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50968 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343799AbiAXSvs (ORCPT ); Mon, 24 Jan 2022 13:51:48 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id 67BB06151E; Mon, 24 Jan 2022 18:51:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30400C340E7; Mon, 24 Jan 2022 18:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050307; bh=mOgLhHho0OlNC/JpctgxY53RxDZv8N0vDhyZlun2JZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3pjVM0PuJMHrJ/1dWupCuo7qSBMeXSfHwpC635DEL2tsucuw5/gOXVDwDpOrcsnE gg7OidspADTt1wwEPMxv5rDsOfeYaC7XPF0IIBMXUV2A/nX3o/m8QKrv2WNNm93Ovl +5mFobGjRfUbnRRV1IxLI6/XAsB2nH3GnPNc/e/w= 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.4 076/114] btrfs: remove BUG_ON() in find_parent_nodes() Date: Mon, 24 Jan 2022 19:42:51 +0100 Message-Id: <20220124183929.439324789@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183927.095545464@linuxfoundation.org> References: <20220124183927.095545464@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 228bfa19b745d..c59a13a53b1cc 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -975,7 +975,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