Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp960735pxb; Wed, 6 Apr 2022 05:23:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbB1lgzdi0nKJ978kzYonwb/tjPnDO1j/CJKbDc/th81Z5cEK/bOAOT525n/kblVW9QvfK X-Received: by 2002:a05:6a00:1ace:b0:4fb:37ad:16de with SMTP id f14-20020a056a001ace00b004fb37ad16demr8400389pfv.83.1649247789726; Wed, 06 Apr 2022 05:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649247789; cv=none; d=google.com; s=arc-20160816; b=DqGmOhMU6tsFYJS/ltW7gmqaMQOwZUvusga07skaq4Yn/uQ6Mk0TxS+RA4PoVcj4L8 aTEOhhuzX21UhSxoNc+P/qNPtyAzeB3q2KiKyz0qXmSk2iNwu2YzaNGFvXczmhmrQzbo Dro+F9pZOC4PjxKCbS1RPfIWwyKad39gxc8+DizXp/QpIXUeKRwZYDrgiFs4UIVteXtE zDSWDC6rdrUDW52JwETn4dvk143lRdWUimCcjGC8G1AHMAwmhwmRzSS3pOYd8Zm/TNim bgRmU6xTp9iDuzf3Jonv8lcQql7gAcBnbcs8WK8BUmO43IEfZvY/hMbU0c+bBDVaDi+v 1JSw== 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=onxAX6Ix5tWPIm82kvoJ/aqOxkE2wNn9PUgBkCSIGLY=; b=uV2WK8tMbCto59IIeaRJVOEMWHF4HVYnoFZe+/MdcjHwssGVxNV9+qk2W91nXqXGbS 8AOPmJ+wunBC4Pfd8xJoZDpupSixOgwDAJFYLpZ/YVeo3WNuS1ZLSn6ACLiWLwlBkd7A WalVJgnBd2CQWCiYIxdudWEDLl5fZX5uJcAkpQEFMI651ULxCcazjJi22P9s9d6HShWO hAdbbz/OC61nuNBqSzN8O6xg19v+xhNx+HYSHd+hnKJqCrv1dn8OMEWVvJYdNZEw8XQv mPjOzn1OI92FabDFpkpV2QbfNjlT2BU1Y98oFXZn/UgxTRR712m3CUszrRL0HPUJDsaU xugQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jrHHyqXc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 186-20020a6309c3000000b003990deab146si10655345pgj.595.2022.04.06.05.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:23:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jrHHyqXc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C73C65F4778; Wed, 6 Apr 2022 04:25:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455365AbiDFAWO (ORCPT + 99 others); Tue, 5 Apr 2022 20:22:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350939AbiDEKA2 (ORCPT ); Tue, 5 Apr 2022 06:00:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92BB86B0B1; Tue, 5 Apr 2022 02:51:21 -0700 (PDT) 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 E562661673; Tue, 5 Apr 2022 09:51:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED77DC385A1; Tue, 5 Apr 2022 09:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152280; bh=vmE0bnZ75a6VCIE9JhhC32nXIyUw3NHWkpsNVT7HH9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jrHHyqXc9RkOhaWaviGyk4AjRkF3p4/ZqTo0wL+Jy04FCrfZAA2YnU+LPbBrRp9SO VqeyTxgTws4tFXHz70sqVZ5S5bo15P2/Ec9SrLFTWlVHjBV1a+SQZDT3c2s1+z6YtV q45ZrGVOvA2THiQVwci/fyltJSH2rGxmriPDjwvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boris Burkov , Johannes Thumshirn , Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.15 720/913] btrfs: make search_csum_tree return 0 if we get -EFBIG Date: Tue, 5 Apr 2022 09:29:42 +0200 Message-Id: <20220405070401.415544732@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik [ Upstream commit 03ddb19d2ea745228879b9334f3b550c88acb10a ] We can either fail to find a csum entry at all and return -ENOENT, or we can find a range that is close, but return -EFBIG. In essence these both mean the same thing when we are doing a lookup for a csum in an existing range, we didn't find a csum. We want to treat both of these errors the same way, complain loudly that there wasn't a csum. This currently happens anyway because we do count = search_csum_tree(); if (count <= 0) { // reloc and error handling } However it forces us to incorrectly treat EIO or ENOMEM errors as on disk corruption. Fix this by returning 0 if we get either -ENOENT or -EFBIG from btrfs_lookup_csum() so we can do proper error handling. Reviewed-by: Boris Burkov Reviewed-by: Johannes Thumshirn Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/file-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 0b9401a5afd3..161a69d7e117 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -303,7 +303,7 @@ static int search_csum_tree(struct btrfs_fs_info *fs_info, read_extent_buffer(path->nodes[0], dst, (unsigned long)item, ret * csum_size); out: - if (ret == -ENOENT) + if (ret == -ENOENT || ret == -EFBIG) ret = 0; return ret; } -- 2.34.1