Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp928195pxb; Wed, 6 Apr 2022 04:33:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi9jg76x29J8nN7oNGgSVwxZ1DhZCUgZDkW1XXD9aIoJBMqsn21Lo6Zb6IFbqaG+vRW3Fl X-Received: by 2002:a05:6a00:8c5:b0:4fe:134d:30d3 with SMTP id s5-20020a056a0008c500b004fe134d30d3mr8427415pfu.3.1649244783715; Wed, 06 Apr 2022 04:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649244783; cv=none; d=google.com; s=arc-20160816; b=Pq+fYzWG23oGEjzMAFShE4EpUYc3KF+ctBVT/eLtIzTPUN+CQYzlHeDIHcud6bcdlb N9jjKCXKIOYB9q3Wms54pdFxx/5/OYtbFea7TwSLsf/MxVZkC8dkKWUs/yiYz8B4lzGy Twkr53DlOkHob7IM/9fjKy7KzMxlMsywKM9jQ+KYGCa41C3mZcme6KAw03oXjK1wEfhh JLX4WJ4/WgbB4bo2Zi36MU67nKJEQ1rz1CmoNaTMa2+Uq4ApCIkRxg5Ev2njo8+2vSdh zTo+CATKxL9YxET5N1o49/kPp2JOpaq5EBkSxZe9DRQtZkGsFQQO5KatKl/9Lb5fIIDc QF3w== 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=x2mG22HG9Ff2xvzg3STPYzRxdJRW8+ZV/8+Ai4f8PBo=; b=XpcJspqmOIqVBr5SNTBQLtwpM9kSQ3uD1Bbp/PTXG1T1nh88FXeqzahfUamjgvvxng X27ywr+RwxNqXDYAkHQOj/SN9BxGc6GYa2e9d6hKdLiI7/Jlvaa2jbYRPQTw0ZtMt1m6 uw7nYqnHF8e9AC4vLm8MejCedTP9JNNAVFMJiR7EM6yAcIh1hFct0a+xiwPajJFmXKJx wZWEmBReQW3WHAxaHMdRp+7NjWujlXBg3KFbaCPyqFmqx/hlaP2IqQlm4rvRY5JxaZ5y GCZK5eH+CYxDysFDKGfLVrRpbBeNeVndvH4P2W9F8fKnNaEISkkhFEfN1f17HDh0Wgfk xTmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2bnFFliw; 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 m2-20020a170902bb8200b00153b2d16463si10595827pls.107.2022.04.06.04.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:33:03 -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=2bnFFliw; 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 B0FB760ED07; Wed, 6 Apr 2022 02:55:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244597AbiDENE1 (ORCPT + 99 others); Tue, 5 Apr 2022 09:04:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238821AbiDEJQR (ORCPT ); Tue, 5 Apr 2022 05:16:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4443BD1CCC; Tue, 5 Apr 2022 02:01:48 -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 ams.source.kernel.org (Postfix) with ESMTPS id EE601B81A12; Tue, 5 Apr 2022 09:01:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A30AC385A0; Tue, 5 Apr 2022 09:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149305; bh=c4RVyvYRsj9YXVP3ghCAxHj+YV5+ROVijwrQU5DYrUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2bnFFliwoRLqJGWIFTkqzDx8GPEo2eRxhf6S5f7Jp1KpEtAfLMnomicvgMGB9CvM5 nWW1Dndu6CSp0V3jvXQ5OjHUoxdhwkEA9w+9RkpdBDPEJOXs+fB1/U3MbZLWVNB+xl TUmVgerJj1mPiG5BGRxZj95JSuekEKR0yYf34l1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Sasha Levin Subject: [PATCH 5.16 0667/1017] NFS: Use of mapping_set_error() results in spurious errors Date: Tue, 5 Apr 2022 09:26:20 +0200 Message-Id: <20220405070414.081004263@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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: Trond Myklebust [ Upstream commit 6c984083ec2453dfd3fcf98f392f34500c73e3f2 ] The use of mapping_set_error() in conjunction with calls to filemap_check_errors() is problematic because every error gets reported as either an EIO or an ENOSPC by filemap_check_errors() in functions such as filemap_write_and_wait() or filemap_write_and_wait_range(). In almost all cases, we prefer to use the more nuanced wb errors. Fixes: b8946d7bfb94 ("NFS: Revalidate the file mapping on all fatal writeback errors") Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/write.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 9b7619ce17a7..7a23b4644507 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -315,7 +315,10 @@ static void nfs_mapping_set_error(struct page *page, int error) struct address_space *mapping = page_file_mapping(page); SetPageError(page); - mapping_set_error(mapping, error); + filemap_set_wb_err(mapping, error); + if (mapping->host) + errseq_set(&mapping->host->i_sb->s_wb_err, + error == -ENOSPC ? -ENOSPC : -EIO); nfs_set_pageerror(mapping); } -- 2.34.1