From patchwork Tue Jan 29 20:52:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10787239 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B2A2139A for ; Tue, 29 Jan 2019 20:54:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F03D02D291 for ; Tue, 29 Jan 2019 20:54:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E42312D2C8; Tue, 29 Jan 2019 20:54:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC8A42D291 for ; Tue, 29 Jan 2019 20:54:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727071AbfA2Uyo (ORCPT ); Tue, 29 Jan 2019 15:54:44 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:36651 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726982AbfA2Uyn (ORCPT ); Tue, 29 Jan 2019 15:54:43 -0500 Received: by mail-it1-f194.google.com with SMTP id c9so6861877itj.1 for ; Tue, 29 Jan 2019 12:54:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DsozCxdNnBZa+LfFa+VpRiDJgBsxqmksHn7KwVO181o=; b=SiE74dzVWOHKlkTQvFTzfkIyb0dXgg04fP1qDMrANuximmGTlsI8C1ktnenFNJiYxu VUmaHhjmfVk+ba7NwZGzv5vszUxDEIhNrTYIFzO99KgjegZvQPmvKX4Mghv2rhmzbuQn Kym2Xg/v7yA1dCDZX5VVOxFFDRB5KjkFZ2ebvPTbjM8Wvv2cTDIk9M9U/CkO8vnnWLog kboIIlOP40fmPhGbOQtODWfMACZnWvzKwcELfzjMStf//NFn3bl2ktQHCR5kWA+XpsHK dIiLTJBJAN1UEpoT9938RH5aFFDlzcMOFcyeV/xyDLlbuAjBaGv7gOj6hVSKnX49qX6Y Iafg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DsozCxdNnBZa+LfFa+VpRiDJgBsxqmksHn7KwVO181o=; b=VaBuBMTap1nFBSCC+uE+87yJVDFDX3oyZaglqYNqD8DHtn3lzxsEBIjzI5KZRliHYl WyrKLIzNVIUYBPOvU2lsblWGdUud/HiXN12FsXuyIANII1MwYxSDpryIMdcH7s4uyBcR n3LTbnl+0NN0dQ6pt4Q6FsAN2bChVZ0YIv5jbUlzRblp7p2epYe1PP4nWFJD6vlC9wLf P1PKDKrhvfNavRfdR+5yGVIf3K3UhQ/H7+NxESeYAxH1icBFYvIIUEV5aLjqwnbwhs9I 3/Mg1iv2M+etNGZoWgWkc21arqbf3zOsCo26JikWb/5zYVyF1YYMc4SJlLj4SCTVI4Uo XUfA== X-Gm-Message-State: AJcUukdtG3ySueRlV620RT37wSFp5jpIF4y+G6BbFynkUAVNiT9+eMe6 aFgxwREppqalQsXXaxJfsw== X-Google-Smtp-Source: ALg8bN4HRCPurjttnTmgXBI29OQa64S1ItlcnxJ2YcvRPVyCJIQ4FS7h2zEZUi9dYnZmzy4K1xmq8A== X-Received: by 2002:a02:b529:: with SMTP id l38mr15818321jaj.25.1548795282551; Tue, 29 Jan 2019 12:54:42 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id k1sm15050154iom.40.2019.01.29.12.54.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jan 2019 12:54:41 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker , Benjamin Coddington Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2] NFS: Fix up return value on fatal errors in nfs_page_async_flush() Date: Tue, 29 Jan 2019 15:52:55 -0500 Message-Id: <20190129205255.12467-1-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ensure that we return the fatal error value that caused us to exit nfs_page_async_flush(). Fixes: c373fff7bd25 ("NFSv4: Don't special case "launder"") Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v4.12+ Reviewed-by: Benjamin Coddington --- fs/nfs/write.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 5a0bbf917a32..f12cb31a41e5 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -621,11 +621,12 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, nfs_set_page_writeback(page); WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags)); - ret = 0; + ret = req->wb_context->error; /* If there is a fatal error that covers this write, just exit */ - if (nfs_error_is_fatal_on_server(req->wb_context->error)) + if (nfs_error_is_fatal_on_server(ret)) goto out_launder; + ret = 0; if (!nfs_pageio_add_request(pgio, req)) { ret = pgio->pg_error; /* @@ -635,9 +636,9 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, nfs_context_set_write_error(req->wb_context, ret); if (nfs_error_is_fatal_on_server(ret)) goto out_launder; - } + } else + ret = -EAGAIN; nfs_redirty_request(req); - ret = -EAGAIN; } else nfs_add_stats(page_file_mapping(page)->host, NFSIOS_WRITEPAGES, 1);