Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3555368pxb; Mon, 24 Jan 2022 12:07:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYcZKaO4yV6bgNw6Dtw3fyQ0uIe1bdxyDeYiuIUoxbauw8bCMWb0zMIXEjYMTvVL9xsmPk X-Received: by 2002:a17:902:8695:b0:149:cb5d:ddf1 with SMTP id g21-20020a170902869500b00149cb5dddf1mr16317372plo.103.1643054840408; Mon, 24 Jan 2022 12:07:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054840; cv=none; d=google.com; s=arc-20160816; b=eUmC8jRiOLgXbw+/ti5I8j7ajPA2Pz+SVVXjJv0lJxxlPZXpUhUTRVaHvzI5bCz6YD eT/KZU4Ilv7dJS/T70u80tkCxGePsidZZ4PaOUdmEn2OwALWG0/+uKyv4HhsBac90H/p UVuCmy3rR3LomKdehEwxqgG7Gyb1iIQGpWnIyO3RTolvc7Lci4iVPDVJYJg0nTdxMAhW KWKag/qHfhvLcuQf16HUzh/3Kskd1z+ajnpRBEo954+Blbpo6XIvWOaNCcGmpT9EslBs uOEiku0FkrloJWDskrpQvF7XZ1Tgqdek2mJffqhNDVmP2ttWw1/nFF1y9h6OTox6/xQi 1Nfg== 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=4nziX2tbNrikFNdF9mQnpKfE909/8mRIysRAS0SvRWQ=; b=PFLej3XFoEu5f8VROQwLmCpZ2g158e2f3D+hu3esAfIIm6VBz9/UKwzw3b/5lLZjOp ecWpAonLOCDW5KNzZE7surT/BTvYIqYlL1SsNtNBRhGrTb3VXr/tOQhfpcflJYmpTior r3+ix5iLPPRd8GjBrsgcI2ASd7pY3PgybQ8pPhMTT1WE964oSNdcGy9FjlCkQa3Y//Jo wU7O+t6aihKlQOfdx+byEc5lKN2/L4jRa4Gx28z9BsbCglyqCQed9uiXo9wjCeuwGdBM 5lguRoYeQrLsQ5Adai8YBgjEpbygprBxdq7U8/zh/8e4hF7479cwj/Hi0h21NX28qov4 XX9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RsbCS2wJ; 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 g5si3273079pfu.292.2022.01.24.12.07.06; Mon, 24 Jan 2022 12:07:20 -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=RsbCS2wJ; 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 S1346123AbiAXTFE (ORCPT + 99 others); Mon, 24 Jan 2022 14:05:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56110 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344731AbiAXS7A (ORCPT ); Mon, 24 Jan 2022 13:59:00 -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 5A33C60010; Mon, 24 Jan 2022 18:59:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32099C36AE2; Mon, 24 Jan 2022 18:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050739; bh=DChxv8YFRrtwCojAA4/44bOFk8gKrjPyvXuZ4JI20dQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RsbCS2wJBkcH9l83tnJ1l0pb9JJE039t9pWmrgAIRXFBsgc07GbLyvSBZCQfHY6rl jQeYY8XyAWklZjpivC8BshAOooxSayYFp/NzoG7bGU0N1Byjv6JpsQhprMPKx4bGX8 a/YNIoilYfba6Jh5n0z8jdrMuL7IVspXbfEm1WsY= 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.9 097/157] btrfs: remove BUG_ON() in find_parent_nodes() Date: Mon, 24 Jan 2022 19:43:07 +0100 Message-Id: <20220124183935.849473541@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183932.787526760@linuxfoundation.org> References: <20220124183932.787526760@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 bb008ac507fe3..29a19bc2abe18 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1271,7 +1271,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