Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp696963pxb; Tue, 5 Apr 2022 19:11:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3KxfOMcWNIvVrudW3dBYciiEV0+8Y9xZT2I1ANQhKapmD6kF7GchpiWE6P8/yBZJF/43H X-Received: by 2002:a05:6a00:1702:b0:4fd:ada2:b1bb with SMTP id h2-20020a056a00170200b004fdada2b1bbmr6602490pfc.60.1649211091296; Tue, 05 Apr 2022 19:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649211091; cv=none; d=google.com; s=arc-20160816; b=hFIeiENOKJy2njfzH4xdUbtjFLmITnDUkiMy0uXF7it6LZMMumLR9kIBpoJ0c8u4vv iUQGXdKVcekrGLpj3LIC72NmI2xoRcimfnrv7ABX06Xm2Qbojp4mwSuuvYJUDLuarXO2 06Y5rKPYDaYmB2MBP3hR38+0KEJ4KFcspWJEv/JSaS5PBkjuhUj/4+fQKWFYR3tq214I HWIE5UTROZ8K3/VUIxYUxiX7h/hXxCag/bQfN2Upy+JKH3uagJ6zcRm//yI6vr6i2Lq8 UIzG3aDqKd9SVM8UH04tarHzN1gLQUFQ1YwZRRo+1grek/2/1s0l2iH/2/NDGXGd8wr/ DsMw== 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=VbrDAM34Z8qIk1RQ9sn6zOFnb53j8yxpxPtgWuloG04=; b=FbElXT6PtYOJg6Ban1uz2E1QomkbUx+rTsdRFaYykRZkPXLMkGf9D6rtVe3mwJBRkw wxfFOie+4yoVeAJanRPoy5h90AZfr6On0BaHwQYQEgn/xFt9R0RWnG0wxweyyaJNgqAH Wb/ybl4GZIHiswBzzn4Lo59qAeAUbjbiuh9fh3sJof3Rp1ReCoJ/whEEBhpB2SRp4Egc LwflubA8ty8bnb7bQH/FyXg3wDBHeNHGrSqprgd0/HEdY1bgrm3o6Z8Y0Y9Ow2qvsFB1 YVLUrCOERH9PKBHLc1oaDwUktMrr1QnUQmffJ3uxtvFjaU4CAG3uBrMN9TCki8G1PnDv LpMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="jyC1/vuH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a170902bb8d00b00153b2d1661csi6439212pls.548.2022.04.05.19.11.16; Tue, 05 Apr 2022 19:11:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="jyC1/vuH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S242650AbiDEJIQ (ORCPT + 99 others); Tue, 5 Apr 2022 05:08:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239406AbiDEIUD (ORCPT ); Tue, 5 Apr 2022 04:20:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3B408F989; Tue, 5 Apr 2022 01:12:41 -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 7F9A660AFB; Tue, 5 Apr 2022 08:12:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93431C385A0; Tue, 5 Apr 2022 08:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649146360; bh=ylwCQIZNfgvvrGBmkmEPItXjHwJURBiYmINh6czOb5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jyC1/vuHz+iVs4Zq9vSXXkWV6c1JqgoBZ3lOhwm1mmFXgR1mhY416lSXKQxIHjJJ7 e64HTpuEjf0I1WmD2uUmxIqY5Zb6uzfhwyaEgfRgStjZN5DfjJnpuwucOVNlSMJuDT Wgd6JPMmHL1G+v0069i3HvUJ9X4OrLz3bJ9z/HAU= 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.17 0736/1126] NFS: Use of mapping_set_error() results in spurious errors Date: Tue, 5 Apr 2022 09:24:43 +0200 Message-Id: <20220405070429.192529937@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 987a187bd39a..da7e57645dcf 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -316,7 +316,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