Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1000823pxb; Wed, 6 Apr 2022 06:26:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUJG2ydk4k3v9eNHfSRgVz7Rg2sGvIewhtzThgYR3zMxdEC3x0PSOnhgqdgp1lQ76bzZYO X-Received: by 2002:a05:6a00:1252:b0:4fa:afcc:7d24 with SMTP id u18-20020a056a00125200b004faafcc7d24mr8725939pfi.85.1649251560843; Wed, 06 Apr 2022 06:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649251560; cv=none; d=google.com; s=arc-20160816; b=lArAMCvmAbGWpNkUNH4qVRz5cnlvsBco1kAESlBbFOyKIhAahrSxQlVeG+2cLTTYNz jKkMb3vFjFdOCL1vKU0KdtCUrz8DSeEFPr6fW8SSwD/4ff+XyGKhtm0ZqWLBPkUru2yU gnMWTzQPBUWCU/YCsrc1InMDpTPlbZoCS26rR3aO+AYgNkge0AhOp4hbZhxaAhZQ6QZd wZf6ThnyDUiVsHptNjk/Keh6RZ4ChNcSf02a2gW9ZN3Thk2Ds9GlAL21wuO2PCJ4jEBN 0kOVXq8J9IRpjPeNt4fiLU4IqLd0p+OmH3ZmXxQUDDkW6zId05b3Bhl7dqLMvGS7dray JuMw== 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=z7j/fjetjnEOXYUoCEZPHyI70RYDUK9GP4r466jFYs0=; b=XeLl/dX/zPNPleuNOvjaz3H/RpYFBb8dvqaejobE+p8JFufb+VOumesPGhDCPRm4dd NPTmeVbvbf5rEq//C8CKDxCXCp/PiJv7smbxOp4nZGwRf8Wn1di5AyjhR0gdzZp82y6M 15Sa8V9YFFYppQx2jjyo/G4gzhwlgew71wXZ1VhS4A+urSFlssChLMt7bS4Q38HjKjl8 N6Qcv1cMCWvmphJjJ8Atq3IKuse2Uudq108jYSbHMXqXUtkh/QwDKzF/TQ/dmiKOlm+k Qw2csj6odmZf3hPbST4HsOp6sLRLm2epGPtBC+jqHGGYKn4m8fj2DpdWsZWkry09jSNv qgpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dBlY9BM4; 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 z23-20020a17090a541700b001c6454edecasi4525623pjh.152.2022.04.06.06.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:26:00 -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=dBlY9BM4; 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 F241652A12C; Wed, 6 Apr 2022 04:02:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455330AbiDEWkb (ORCPT + 99 others); Tue, 5 Apr 2022 18:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349439AbiDEJtw (ORCPT ); Tue, 5 Apr 2022 05:49:52 -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 7C3232612A; Tue, 5 Apr 2022 02:45:57 -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 ED5E061673; Tue, 5 Apr 2022 09:45:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 085BAC385A2; Tue, 5 Apr 2022 09:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151956; bh=vlsDkRIrg9lVMWtGIcEFZ5hEXMuZHl/txAJWCN+u1qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dBlY9BM4N7DWnd1lRQ2kxf2JNO3FTiObGXicreLCZFaIQKdpHvlv2iS+HFaLPi9rs dy1L5Ef3sFKXXNN9rmevA21ddlvCitFECkdT6f3fPgPpZCeHoC6SzQMbTp24yyD4UA lT6Rorfd+7DamsloMog/yFXaH0jqv2G4pITHlsQ4= 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.15 602/913] NFS: Use of mapping_set_error() results in spurious errors Date: Tue, 5 Apr 2022 09:27:44 +0200 Message-Id: <20220405070357.886289136@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: 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 7dce3e735fc5..0691b0b02147 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -314,7 +314,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