Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5640859pxb; Mon, 28 Mar 2022 15:22:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLq9Km3RmRiGpCaOtv63KD9E3NxKfSuRk3L22ICp9WdqxbN4Mc95CJD26O7EjeINvyVzmy X-Received: by 2002:a05:6830:1f49:b0:5b2:5c16:3dd1 with SMTP id u9-20020a0568301f4900b005b25c163dd1mr10986717oth.207.1648506133146; Mon, 28 Mar 2022 15:22:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648506133; cv=none; d=google.com; s=arc-20160816; b=Xg8oYqV3wPJjnpt0D1rHJYXvLRJmZM9giDGBNgwDsAt+ct4kQjVS/5G7yy5M/q4kvI DWp+RpvwHeDxMvHCp/e34ZJ4HQqhaSRWQS4Pu50n6hnCJQivl/ektzHGEUxqzR87/pZs kq76emaE2jtg1JOyfUCXmxWO8k8DEaFs2x9qLwZdAaQtGErRHCmJT+Et05t/fc8tSLke HaA2q7gIYwYIylVYwA1HW+RtPhF4A6gAQLeSoN0r97gkmK1aiZ0VrruxVqwwSzSEdkU8 QU4mvmeVCy9pjIonhTvbHt77uaGiIrY6m/prYUcKSMAW2T596jMLJ7S+jFe2L+cXhJYs SQvw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tSxQ4S1oVONwtuPlRx2CcdUuO2oUtpYGT8WPXDgS2qU=; b=czFzYBynD4W3Ybuf7XI2rqf9YWzmWYaU4JWuiok91WHa6PvN7d+XvtHE8frjKYkeHa KaJPZA8LyQe79at0cdAD/rFSAMISBiTi0/+fgT68B4fRpG9eSO1uI2mhFkIBf5mEcZ0G CVz28xvXXvRqEhNu+i39YLQ60gP1NBuTqYLqvf/kUfg/tzXSbzzu3lVOjrEn4C42E2jo BM5td5SekwMnTv1hP/a/Gf9qoI80RH8HlD414xNhVJAoKIO3zBjTkemDv5C2xIHKZnFg jWmHPdKKtlow/z5u18VNlPBBlBHIlLk0n2zzNpAm2LzNhcyx1tRyQUyqicf0rojC8pa5 xaDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E7GUh5q+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ej33-20020a056870f72100b000ddaa23f6fbsi9765788oab.239.2022.03.28.15.22.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 15:22:13 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E7GUh5q+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CAD7D193B77; Mon, 28 Mar 2022 14:36:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237668AbiC1To2 (ORCPT + 99 others); Mon, 28 Mar 2022 15:44:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343523AbiC1ToB (ORCPT ); Mon, 28 Mar 2022 15:44:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CD97673CA; Mon, 28 Mar 2022 12:42:16 -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 E3AB261291; Mon, 28 Mar 2022 19:42:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61AF3C36AE2; Mon, 28 Mar 2022 19:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648496535; bh=yfFQMkt22AT3DrmgMc0PYxPSMl6cUeOgdMtXP03H498=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E7GUh5q+JWq//gHmD77/EliafaSxFdrObleBwbBwVw4HuhzsDAtBp3unKC729oWx5 lS1AxtfR7Nyipwtt1654lnMZiPpbadnt2HGBcXn0155c/pmkJB7qeRaE+8OCJ2Fdez KGZb6LDgsYlmoibtc9NkbF0QgC2UcgxDwu+7o/tFZsK4Usxgat8+9a2A+A7bl+D9KP OHbvASSKq3paPTIDqahtKx9cMKvCo95g9vOEw0+fBxYNwRwNnbCz0HXjz1LtJtNgs9 xoci5hWbosYn6IlqTloa4ZOkSluUgVziwc2l/WfO4Ex2AnYxuP2CusQDWQYBwBa9S8 CR1kDnaGybJAw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Josef Bacik , Boris Burkov , Johannes Thumshirn , David Sterba , Sasha Levin , clm@fb.com, jbacik@fb.com, linux-btrfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.17 13/21] btrfs: make search_csum_tree return 0 if we get -EFBIG Date: Mon, 28 Mar 2022 15:41:48 -0400 Message-Id: <20220328194157.1585642-13-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220328194157.1585642-1-sashal@kernel.org> References: <20220328194157.1585642-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 42c1073a4e13..f9813853eaf8 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -305,7 +305,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