Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3579674pxb; Mon, 24 Jan 2022 12:42:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5sJsM7Uk4V1rPyP4vbCehWRZmuZAbNY1nJBW7KR64f8JEk0lVGktFvFCh9U5+YnuEPDWX X-Received: by 2002:a17:90b:2252:: with SMTP id hk18mr95171pjb.53.1643056940323; Mon, 24 Jan 2022 12:42:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056940; cv=none; d=google.com; s=arc-20160816; b=JbqYFv+pn//9NzCsuvqisL/JqmZ3TwK1iQzmQuineLUVsjP1iv4GL2yCEChn3GggO4 TuXH+hCfP3CkysY3YyJm4r+SsMNLyhZq4Crit7GkdOk3s99hDsG8HPHCiEuaK5/5yrlb Ft5x05FDJ9tWBtmU1IyRG1nfO4kSWMnOpVWcjT8szHgPMFFrl+gMBkpjE6T5GOSuZiEi Pjv8rmR1VEZ4Fb/0c1aigWIQM1FJ1YHXnEWYPy8ItlV6gDtDJzdwFpsC2+DtQ2Jrn+zu +jZUokCJ/QKzUJ9f5G1rVaMN+W56XGrgWAuYkNfDda/oRtIupqbjV0z5UgVbzE31y73z O6Ig== 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=pL7WtnU873s9GfBTXsFuJ2pZGD0Qq7kcyNZdlsZAtgg=; b=ZsCBR3cnL4+cntkqPfimEfA2YEAJnuJmnuG+Fz8phbkW1cENNT6mnKlBk/x1mf3/E5 gP7JUb85nxtFw7QLwzgnJ3pQV2RoCC3VwhLQ1NLJgxKtLV9Idd6W2D4nmTUDaGKWU2TI xuurYwjTrlwHKjeZA1VsZ8YyXQ/8FeUoueQkng2GSZS1PiALdC+21LQt0xTi++BkU24F tpMIgUP7pjxE1gp4T5/WdNihHHStWKpAthuWrL8/vjpkFkAf01vZ9UsPHO/wyMNbVuy6 KdiW8znh/uZbw6M/aFfcN4csPqYnXD7jWgmXMVz8dCBnQT+86aSK6UwJGj+O/sn5RmEq pQWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1Eqe0TGl; 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 j28si14512103pgb.379.2022.01.24.12.42.02; Mon, 24 Jan 2022 12:42: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=1Eqe0TGl; 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 S1359557AbiAXT7t (ORCPT + 99 others); Mon, 24 Jan 2022 14:59:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353154AbiAXTlB (ORCPT ); Mon, 24 Jan 2022 14:41:01 -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 64064C07A972; Mon, 24 Jan 2022 11:20:40 -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 1B01CB8122C; Mon, 24 Jan 2022 19:20:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46767C340E5; Mon, 24 Jan 2022 19:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052037; bh=9k+0td24Rq5fuWTlvA2sDlkDcCThTqWcZMKgeg9KNVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Eqe0TGlFk8oNlIyukGA1flwlkEXdv2JOCXydv9Joha0eN+gQRNKF96B4wJjXfuyC 4jmtdB0ynLlcqYZjE5fdToEn2W8MeOwrkQ8djUXq85n1vom1TpvnVVztXEg10irHcA FGchTktuXwaFg4PN8IVNyimeV4aAFMLrScfYDok0= 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.19 167/239] btrfs: remove BUG_ON(!eie) in find_parent_nodes Date: Mon, 24 Jan 2022 19:43:25 +0100 Message-Id: <20220124183948.403152892@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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 9f05c09d6baef789726346397438cca4ec43c3ee ] If we're looking for leafs that point to a data extent we want to record the extent items that point at our bytenr. At this point we have the reference and we know for a fact that this leaf should have a reference to our bytenr. However if there's some sort of corruption we may not find any references to our leaf, and thus could end up with eie == NULL. Replace this BUG_ON() with an ASSERT() and then return -EUCLEAN for the mortals. Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/backref.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 0073182d4e689..3fe15d6f40873 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1313,10 +1313,18 @@ again: goto out; if (!ret && extent_item_pos) { /* - * we've recorded that parent, so we must extend - * its inode list here + * We've recorded that parent, so we must extend + * its inode list here. + * + * However if there was corruption we may not + * have found an eie, return an error in this + * case. */ - BUG_ON(!eie); + ASSERT(eie); + if (!eie) { + ret = -EUCLEAN; + goto out; + } while (eie->next) eie = eie->next; eie->next = ref->inode_list; -- 2.34.1