Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp577216pxb; Tue, 15 Feb 2022 22:39:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwf4iQrudmGKa16s42XPnOBYG/PN0GLShFMmFdzlGZeCmGpooGoQW9UA4qx9hDJ7fZ6fK/T X-Received: by 2002:a17:902:7c0f:b0:14d:a05a:c750 with SMTP id x15-20020a1709027c0f00b0014da05ac750mr1081000pll.16.1644993553727; Tue, 15 Feb 2022 22:39:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644993553; cv=none; d=google.com; s=arc-20160816; b=rqlwATuPZIOk3eukq5/dyNIOMf+3fg9XZuY02LD6a0qaWyJoO7u5gpKuJ4f91+04Tw rT8lMRp4eYKhcumzuGeEBrXzv2AftVmtrsoHtA4VsRxlO8GFJhZzIvfT/dQzryLU0K1t Zla+iTBNteKOadkcJQaqm5M2RnQ/x6oprO9yo1I2JkpLfb92/Y8+1E1mBWwEco0H8OEn IDqI3yN5kSP2uvezfvc/a9Jy4UVxST8rFVowg5KdfN/4zbqXcFSOPrPOa6U4tSBnyRNe 9tdHwT2FAsFz3MZ/CzkbkiprcK/LpAKikLI07aetYQ3os+zJ/dh0dolkH+CrQZ4gKJQq MqOQ== 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 :message-id:date:subject:to:from:dkim-signature; bh=MFuG36OgA7mX9V9kM+vCN/CiQ2S+NMfieIx6M+XWs5E=; b=qYHxt7z7884rY7AWRJKBR7RxhfeplOJSL7pBrRqa6ByRiCOc1wiVwbYhNVlB8Yft4u fX9aSAe97hAjM3/jcM6Ywn5WBZDFhdvwgZj/Th4qZM/xuvS3H6CPjuPsIbElKEDGgHgu pOcOs82/Jk1+mvliPS6LI3KJ0s22HoIAxqm8/RR5CZAAJc5t8OfLrLKrsAiVHqWLB3R6 BfwUbisC+pKg1y1xv94gILfRQGbrc33Ssj8nbqtbu3dZZlWzFKMH/KbFWMZIhL3CbRkb osx7fEqKhdcdOVwdUDf7J7+OcxgdHYC/KDVda8rK5jke1yXzohLjZfP4k5C2BFilbwbP p4vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Il1xzKd8; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-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 kk18si11650921pjb.167.2022.02.15.22.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 22:39:13 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-nfs-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=Il1xzKd8; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-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 36FBF1B7610; Tue, 15 Feb 2022 22:29:42 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237204AbiBOXL5 (ORCPT + 99 others); Tue, 15 Feb 2022 18:11:57 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229729AbiBOXL5 (ORCPT ); Tue, 15 Feb 2022 18:11:57 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88F1413CE8 for ; Tue, 15 Feb 2022 15:11:46 -0800 (PST) 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 F381861507 for ; Tue, 15 Feb 2022 23:11:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3355AC340EB for ; Tue, 15 Feb 2022 23:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644966705; bh=JgCJYNhJMwTHRIJVMHEOfQtH3nNGTQ66/9NWsyN7KGE=; h=From:To:Subject:Date:From; b=Il1xzKd8uyfyFLmoaoYQZTF/e18MfN4J+F+Y5V0gb+9agf16+Vi2hU/cxOQOqYqWw ogqZYxpZpaRY/eGawBCH1JEEBnmLzsWoRTayNAA5jZhhu9IRa0z+kTJPHP38BTA8rO dgGdgZf0l1qaeXX672FqWipl0klrr91iorpnHwqnA51X0e91p8yKKttK2p2e3i7ehv zw+TC2Hpbmu+5FYjEHU62/n4KwjMMG/m/b+BUDl+8UTXg5TDtMeAuVShbgSlmavVTw oCiLsrnDBAOuPBwhdpI636gELoKDr784zf//mh7LD55YWVkoKIR3zt7+vaeWwBuzkJ IdVn6cA7vl7qQ== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 1/2] NFS: Use of mapping_set_error() results in spurious errors Date: Tue, 15 Feb 2022 18:05:17 -0500 Message-Id: <20220215230518.24923-1-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 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-nfs@vger.kernel.org From: Trond Myklebust 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 --- 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 f88b0eb9b18e..74d258781205 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.35.1