Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3677280pxb; Mon, 24 Jan 2022 15:07:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBRNXYgaXnn5PSP9+mgTrboj6FB/V0GMqYOvL//n6v4fwWaJSUPHmlkHRaqFkJnydrL8Ji X-Received: by 2002:a17:90a:7c0b:: with SMTP id v11mr587921pjf.180.1643065630179; Mon, 24 Jan 2022 15:07:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065630; cv=none; d=google.com; s=arc-20160816; b=mc7W1eNMNPNqvLkldCyEHFOEbHkBAotoDtA4tS+Vn8O5ZigMvOF3QZ7w/evi+ghmMw VUSujoj0Dw0B4GfWvWPO3I8KAwvE50VgWeDKVXnp/02WOcQxFs5fI8GBVr5071mP9zzQ 3eWC5dKNpa61VahveSgsDDKi7NzWxEZRWgcqu1t9JdjviRxzXNnSpO/sdWyd/5SQ5dmX AycLuHdMyoqdy+Z2bp8SRXPTYQEqkyUf62pJe4O5e2FYdnlu5qTWif93BzqKZSTMH8AJ Vv+H4B9sncinVmCQ/ZNjrbCxF8hCkWCJ0JtO4xE9o/6S95Hcl04w3qlyN7ykytFMBSlY RVPQ== 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=3pNIIxw97xY6xHNqJStsHC7kPQ0fdQUAArQaa0fPiPc=; b=otTrawCtk7ybUrBBDNCi18kb+MYA2SfPZigAotUDRlnvAKQxXTKD2RzkvWo6MEcq/e il+7g+SV2xBPfhsL33V8BxpS2MzfL6TeTf7t8Bsvscac+sCFXHjV37F9RORYaXykqN7J JYRsSDUX3oD9x3Xk1/k3UamBq6UuGharX8mlp+Fsr+yP56rByzbSkv24W6hg3yhAt2Fo f108ezKJG4ysECM0FKcptLq0Ru0Fx9wLvJCAADD4MRuJvMRcTc6HZhA/ef3KAJGN3L2J EfXes1zamLVSN7w5tWafmhWuJLLk0RS9S293+1oI0Rv9U/rU1ZzwNfTl9aDQ0cbXTbMi y4fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="a/+gyR8V"; 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 lj7si595035pjb.104.2022.01.24.15.06.28; Mon, 24 Jan 2022 15:07:10 -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="a/+gyR8V"; 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 S1842906AbiAXXCy (ORCPT + 99 others); Mon, 24 Jan 2022 18:02:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1577106AbiAXV7S (ORCPT ); Mon, 24 Jan 2022 16:59:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C85DEC0C092B; Mon, 24 Jan 2022 12:39:48 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 4E29761383; Mon, 24 Jan 2022 20:39:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3455EC340E5; Mon, 24 Jan 2022 20:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056787; bh=nODJdLZgNtDJsYBxRp1SexhPYRVVlpVwxtcXBGJsMPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/+gyR8VpB7eaTrj5lEp6eYxWq8qnWoCdrRfXIlv7e/VqWLq9NxK7QxOPVkk48b9q F44nsP3YVLI8VO0Jcn7Nd/3l5BkKZbf3dWFR/Pd2KBu2kms30tCN998IW3yJxQdcVI STMRmvvVQEgFIFH+MgCpDlRx11Z82vy3ep8+RIwc= 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 5.15 600/846] btrfs: remove BUG_ON() in find_parent_nodes() Date: Mon, 24 Jan 2022 19:41:57 +0100 Message-Id: <20220124184121.725700779@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 f735b8798ba12..6b4b0f105a572 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1214,7 +1214,12 @@ again: ret = btrfs_search_slot(NULL, 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