From patchwork Sat Aug 17 21:22:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11099301 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 D4144112C for ; Sat, 17 Aug 2019 21:24:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAC8628305 for ; Sat, 17 Aug 2019 21:24:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD9CC28911; Sat, 17 Aug 2019 21:24:47 +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 1BDAE28305 for ; Sat, 17 Aug 2019 21:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726208AbfHQVYq (ORCPT ); Sat, 17 Aug 2019 17:24:46 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:34538 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbfHQVYq (ORCPT ); Sat, 17 Aug 2019 17:24:46 -0400 Received: by mail-io1-f65.google.com with SMTP id s21so13262344ioa.1 for ; Sat, 17 Aug 2019 14:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=qCGA2TmA+nMZ+Z1J35XJOhhry7QPJqY9FODU49e9HsU=; b=ZMdAUQLOEUU4CZ1LX89/XB2JDfLozdorCsDfpcHWQkszb71M3KvjhGrplAtvtAbErO wI+6q+b63SBHmVdM3o9SaK1oub6VhhscXAq3C2Mkdx2XXENWZAymkNplLJQgSNT0k3dw cVwZJr0jVwfxAqMsj9G8YglZfgp28qPVUqEPx6sc2ToHORTSczmx9Z8gSsw5Zf7SW4w2 VjQnnoBSFDutizZc1dJ4Cd+teFGei+Qs45uPtKpVHF9jwXMXP0cJ49QbGv+BG5hEQHAp 02Acaapulguwihnc4dLakf1Ge7Ll3hLAUcOQwsxEkl5w1AgRfv24ZYTNwfL4wza6u1WY T5Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=qCGA2TmA+nMZ+Z1J35XJOhhry7QPJqY9FODU49e9HsU=; b=OkUzcPzsoXmnsvofzl0Mrq94A6TZTlQzxRrLLphqv1uExAH2WZpgNQzWyCxJwsfPRV BTWIjvvECts9E3/R0nuxWjv/RPtlUUa6snLLAY5AyYLsvwuRBpugeoCqCo6OBeCC89IW flkRsTaJaodit7ryCl8/nHgz6w+fl92oGW2LoPTAaAY7E5SNnmrxt91XpojWvxZ8i6Wg FdrDiCIQ9jUH4+p/6SE3yuabHTfBd1WlzbVE8Yhv7oxD9PSxO5O4s4e4PFN07cvwHf3p qlGjIUu8hrllTvwlEWLdkdHe2/oUpVIMoG2CaIRmwMFtl8uPOKxpYb8gdJXK8PyTqWi9 f3aQ== X-Gm-Message-State: APjAAAVnEVNROpWcWCwpDLRbKGjG+87BJPiztdtaZAJwBXifbDKJVZRq mVjGXCvXXnWeCZAL3688VH707uk= X-Google-Smtp-Source: APXvYqzNfwNhl7lnBmV5QSm2RjmxvAHW1KSjHDddNMSi7D9uc9TgHCV0sIkXN7CSiiN8pKxZSAlZ0w== X-Received: by 2002:a05:6638:637:: with SMTP id h23mr18507799jar.59.1566077084919; Sat, 17 Aug 2019 14:24:44 -0700 (PDT) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id q3sm4609806ios.70.2019.08.17.14.24.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 14:24:44 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 1/8] NFS: Fix initialisation of I/O result struct in nfs_pgio_rpcsetup Date: Sat, 17 Aug 2019 17:22:10 -0400 Message-Id: <20190817212217.22766-1-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 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 Initialise the result count to 0 rather than initialising it to the argument count. The reason is that we want to ensure we record the I/O stats correctly in the case where an error is returned (for instance in the layoutstats). Signed-off-by: Trond Myklebust --- fs/nfs/pagelist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 56cefa0ab804..20b3717cd7ca 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -590,7 +590,7 @@ static void nfs_pgio_rpcsetup(struct nfs_pgio_header *hdr, } hdr->res.fattr = &hdr->fattr; - hdr->res.count = count; + hdr->res.count = 0; hdr->res.eof = 0; hdr->res.verf = &hdr->verf; nfs_fattr_init(&hdr->fattr); From patchwork Sat Aug 17 21:22:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11099303 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 1C1D756FE for ; Sat, 17 Aug 2019 21:24:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DADE28305 for ; Sat, 17 Aug 2019 21:24:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0235C2890E; Sat, 17 Aug 2019 21:24:47 +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 A81C52890B for ; Sat, 17 Aug 2019 21:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726163AbfHQVYr (ORCPT ); Sat, 17 Aug 2019 17:24:47 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:35254 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbfHQVYr (ORCPT ); Sat, 17 Aug 2019 17:24:47 -0400 Received: by mail-io1-f68.google.com with SMTP id i22so13251083ioh.2 for ; Sat, 17 Aug 2019 14:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BA/ETkjck+FWFnrZFNTs1+XU0segJTkXO5QVqQNNRoo=; b=bqNit5jYAtD9piHdPm+kdAvWjHb+o7dDUYtRf1edy96btZirulszylpfvAv3Winue6 DyNLpg7JPFmIdTEgO898Ns+KbxKATiEURJ00EQAE4YhZCAv/OCx8TAOEAeL7s8ilBOhs bJKL5n1gdUnFwMuFB+H6rISrMc8pmQO3MCHkXQmbG6jt2IqmYhUrzAFyIKsL4PQ4Dk3F JTSXKBP8t9xpSLkobHe/6GE9HkpTzuwFYBbtUybE5rogw++6TBJs1Q50iDsN7BOQEpzK EXpycDTSiq+DDXkmcqfaRKJkwh6cC5Fdzla/gPocCjLciKGsxdyIAB4sfNI7yHcryOXs SgfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BA/ETkjck+FWFnrZFNTs1+XU0segJTkXO5QVqQNNRoo=; b=jHpW8FB81Rn4fr3AuFPp/qFXlLxjCclJn2WSj4sCCPui9gvBrU8k5B0MAQkse3l5Oc wrFsx0SJNJUlB202e3g0k13DgbUHhKmmDOCMaNrI4MXvfcsq78W7FYsgYIC17P3HpNXT B2s5ydmZISEufXwym/vAqEfxandWoYTJ6V2bOxotWJKM0PXzocYfFJR50EXsuzay/yYc 2paEMqeDrReN5ZWE90mW2o6JFKuTCxfYBgXVOATn7RAWKVb1Y53fhiui8HhTbiwa3L96 /rXuA6LG9MYArgAQ0eGfREttvHp7hTXYVu+7ZzyXeOPADfb5Teebg1mT/VKzDP8IZERq DJTw== X-Gm-Message-State: APjAAAWTvdBd8YxDeMglH5x5Eo4noZSFpiC0pOXjl5XMA0yFmz9tfkxe /s2x+pG8lyP531Q8kNR/6RTP4i0= X-Google-Smtp-Source: APXvYqxDdaGWCh5HERhYCH9v9F68UmJQph5RhY7r22nstoMUA6kAsxzxQeyWYS1Bd3jDv4S3vUl0jQ== X-Received: by 2002:a6b:8f82:: with SMTP id r124mr18817093iod.6.1566077085642; Sat, 17 Aug 2019 14:24:45 -0700 (PDT) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id q3sm4609806ios.70.2019.08.17.14.24.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 14:24:45 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 2/8] NFS: On fatal writeback errors, we need to call nfs_inode_remove_request() Date: Sat, 17 Aug 2019 17:22:11 -0400 Message-Id: <20190817212217.22766-2-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190817212217.22766-1-trond.myklebust@hammerspace.com> References: <20190817212217.22766-1-trond.myklebust@hammerspace.com> 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 If the writeback error is fatal, we need to remove the tracking structures (i.e. the nfs_page) from the inode. Fixes: 6fbda89b257f ("NFS: Replace custom error reporting mechanism...") Signed-off-by: Trond Myklebust --- fs/nfs/write.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 92d9cadc6102..3399149435ce 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -57,6 +57,7 @@ static const struct rpc_call_ops nfs_commit_ops; static const struct nfs_pgio_completion_ops nfs_async_write_completion_ops; static const struct nfs_commit_completion_ops nfs_commit_completion_ops; static const struct nfs_rw_ops nfs_rw_write_ops; +static void nfs_inode_remove_request(struct nfs_page *req); static void nfs_clear_request_commit(struct nfs_page *req); static void nfs_init_cinfo_from_inode(struct nfs_commit_info *cinfo, struct inode *inode); @@ -591,7 +592,9 @@ nfs_lock_and_join_requests(struct page *page) static void nfs_write_error(struct nfs_page *req, int error) { + nfs_set_pageerror(page_file_mapping(req->wb_page)); nfs_mapping_set_error(req->wb_page, error); + nfs_inode_remove_request(req); nfs_end_page_writeback(req); nfs_release_request(req); } From patchwork Sat Aug 17 21:22:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11099305 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 4AAB118EC for ; Sat, 17 Aug 2019 21:24:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B1D728305 for ; Sat, 17 Aug 2019 21:24:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FAE12890E; Sat, 17 Aug 2019 21:24:49 +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 BB61B28305 for ; Sat, 17 Aug 2019 21:24:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726229AbfHQVYs (ORCPT ); Sat, 17 Aug 2019 17:24:48 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:38412 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbfHQVYr (ORCPT ); Sat, 17 Aug 2019 17:24:47 -0400 Received: by mail-io1-f65.google.com with SMTP id j6so13240471ioa.5 for ; Sat, 17 Aug 2019 14:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=MDS0tZNKxie2TCRV1Ss/PJz91xkx1JaH1CgyasQ4Tto=; b=BiyvP1G1F+3eTdzSDGG5VJfpTFkK/BmOrDy7acqEzMZv0qoXrWq2xZzvFceyiEcvN2 3XaYiGWodpH99o9TP3X+HCrH5/33lXj/t3hcUhJBdjYJFvlJF1icLurhmtEBnhpAnJhg j8hK1VAD4zV/B/SwdN6Wd+FW/ETELZawsCE3BqQ3m70N88o01fWtvO0zQZLcGQM5l266 Kv+VO67wHfeYk4BXW67djekA7FUMKZaj3JWK0zB0jWl1J7yf8NGr201VBw0PY2xgnXKc 7RlUabYFUiiTiRzWhQncwYHNezsUJcfkrdW+RoGPzzV1L5eYFYSuK7UnmKCHZm+XBj8w NmIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MDS0tZNKxie2TCRV1Ss/PJz91xkx1JaH1CgyasQ4Tto=; b=nX5gCJyEAwTWkcdoj3WU4+Mfry7GLru5INt4GjD8U6QnxRF9BBiuvh5N4jgkyIhn+G RXSJeTxhJGPKRrsdoAeVJQ+lcWh+eKmYpCCXVIyBRpMGeJEn3IL2mejtTmWaOs+Ch43c FQt8FhoyCuqfd9TnalmFMNIKF+y6na+MdRs+OyPrtKxhd7z3eAcl8CzCMthkrPZF5U2R Zrjc5tO2RUbZWo7m10Jabunbpvx4klOAbknycq3zccQBOA7zX0viakf0YZ2tbMF08DRY DVqZw+8f6BcEG+1bRruyjjgqYHUpmPXbPRuzOLbp4wVxxU6/wP/iWbLFW9OC+qAh36RQ 7d7w== X-Gm-Message-State: APjAAAW4u1IODISSqA7orkGdZgAD0fCb4D340TGW64JAPTdU3cNsgXsw uRvnQMzKh5lAOW0gqLjdalKb4Yg= X-Google-Smtp-Source: APXvYqz9Ze++52gOOTWabdQsA4LkvZ5sO/Nh4T2/M+UWgi76yVpFbUf/MDggNGGChP/qrevbpdPA9g== X-Received: by 2002:a02:5105:: with SMTP id s5mr18294029jaa.42.1566077086587; Sat, 17 Aug 2019 14:24:46 -0700 (PDT) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id q3sm4609806ios.70.2019.08.17.14.24.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 14:24:46 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 3/8] NFS: Fix spurious EIO read errors Date: Sat, 17 Aug 2019 17:22:12 -0400 Message-Id: <20190817212217.22766-3-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190817212217.22766-2-trond.myklebust@hammerspace.com> References: <20190817212217.22766-1-trond.myklebust@hammerspace.com> <20190817212217.22766-2-trond.myklebust@hammerspace.com> 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 If the client attempts to read a page, but the read fails due to some spurious error (e.g. an ACCESS error or a timeout, ...) then we need to allow other processes to retry. Also try to report errors correctly when doing a synchronous readpage. Signed-off-by: Trond Myklebust --- fs/nfs/read.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/fs/nfs/read.c b/fs/nfs/read.c index c19841c82b6a..252f31bfd497 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -91,19 +91,25 @@ void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio) } EXPORT_SYMBOL_GPL(nfs_pageio_reset_read_mds); -static void nfs_readpage_release(struct nfs_page *req) +static void nfs_readpage_release(struct nfs_page *req, int error) { struct inode *inode = d_inode(nfs_req_openctx(req)->dentry); + struct page *page = req->wb_page; dprintk("NFS: read done (%s/%llu %d@%lld)\n", inode->i_sb->s_id, (unsigned long long)NFS_FILEID(inode), req->wb_bytes, (long long)req_offset(req)); + if (error < 0) + SetPageError(page); if (nfs_page_group_sync_on_bit(req, PG_UNLOCKPAGE)) { - if (PageUptodate(req->wb_page)) - nfs_readpage_to_fscache(inode, req->wb_page, 0); + struct address_space *mapping = page_file_mapping(page); - unlock_page(req->wb_page); + if (PageUptodate(page)) + nfs_readpage_to_fscache(inode, page, 0); + else if (PageError(page) && !PagePrivate(page)) + generic_error_remove_page(mapping, page); + unlock_page(page); } nfs_release_request(req); } @@ -131,7 +137,7 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, &nfs_async_read_completion_ops); if (!nfs_pageio_add_request(&pgio, new)) { nfs_list_remove_request(new); - nfs_readpage_release(new); + nfs_readpage_release(new, pgio.pg_error); } nfs_pageio_complete(&pgio); @@ -153,6 +159,7 @@ static void nfs_page_group_set_uptodate(struct nfs_page *req) static void nfs_read_completion(struct nfs_pgio_header *hdr) { unsigned long bytes = 0; + int error; if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) goto out; @@ -179,14 +186,19 @@ static void nfs_read_completion(struct nfs_pgio_header *hdr) zero_user_segment(page, start, end); } } + error = 0; bytes += req->wb_bytes; if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) { if (bytes <= hdr->good_bytes) nfs_page_group_set_uptodate(req); + else { + error = hdr->error; + xchg(&nfs_req_openctx(req)->error, error); + } } else nfs_page_group_set_uptodate(req); nfs_list_remove_request(req); - nfs_readpage_release(req); + nfs_readpage_release(req, error); } out: hdr->release(hdr); @@ -213,7 +225,7 @@ nfs_async_read_error(struct list_head *head, int error) while (!list_empty(head)) { req = nfs_list_entry(head->next); nfs_list_remove_request(req); - nfs_readpage_release(req); + nfs_readpage_release(req, error); } } @@ -337,8 +349,13 @@ int nfs_readpage(struct file *file, struct page *page) goto out; } + xchg(&ctx->error, 0); error = nfs_readpage_async(ctx, inode, page); - + if (!error) { + error = wait_on_page_locked_killable(page); + if (!PageUptodate(page) && !error) + error = xchg(&ctx->error, 0); + } out: put_nfs_open_context(ctx); return error; @@ -372,8 +389,8 @@ readpage_async_filler(void *data, struct page *page) zero_user_segment(page, len, PAGE_SIZE); if (!nfs_pageio_add_request(desc->pgio, new)) { nfs_list_remove_request(new); - nfs_readpage_release(new); error = desc->pgio->pg_error; + nfs_readpage_release(new, error); goto out; } return 0; From patchwork Sat Aug 17 21:22:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11099307 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 2FF4018EC for ; Sat, 17 Aug 2019 21:24:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21F0728305 for ; Sat, 17 Aug 2019 21:24:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1683D2890E; Sat, 17 Aug 2019 21:24:50 +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 B1E5E28305 for ; Sat, 17 Aug 2019 21:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726198AbfHQVYt (ORCPT ); Sat, 17 Aug 2019 17:24:49 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:35256 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbfHQVYs (ORCPT ); Sat, 17 Aug 2019 17:24:48 -0400 Received: by mail-io1-f66.google.com with SMTP id i22so13251152ioh.2 for ; Sat, 17 Aug 2019 14:24:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xcXU+vb6y2gxdMrgR5dsOskgKrG7qU16OXTYGfF708Y=; b=kP71JI2CVLdU/KiruOMBKxM7DBmbEFkD58NG/ATluJVVSJFgnbZikkAhJsMEgaJiFl cLHSpsTGkrQ9bwtDniz2EE4NgGnwAJuWyhDET0D+cpa377zLpavJnvXTGX4u/BP4ENTX EIjfwarb/yrEpYi94myXcNTQiNzxcAjl7YXrqgoLW/eIc1vH4kr07FcZ0qFkCR7ZKyVP fMs7ZxrlVYMthM3BI52WxA9XHbtWBkpEleN44de3ZFXe5iUcEfSlYgRXrdZW5Vy5D52G olNgYlRSrNpkt2uwFUfHiYZ0L1Tb2Q1sagleiimkVzX21948uWSnyyDQCqZVis2xSGIe YROQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xcXU+vb6y2gxdMrgR5dsOskgKrG7qU16OXTYGfF708Y=; b=aahlJJ7l5jUMcnUSwGM3bXHC+UJDhKeMnvssMFa8xgMGKliXTY+5XNXHk2trLdcbdO hTkIxCUKC8buT2OZDxXV1aMWhhykpGTwfKlnVOvzct7jLtmzItJ0bFBlgkJgSfCgdOpS wUgbJn1e2+UR1Td+Ns2uXkdRLvhUtt7SRGNPD62KHUmcwjeSIQqTgzkk9L/sDK/BEDcY wLXZbj8rWvJ/xAlCfUaD7S3uEkcYJZIrecxyKNhYfIzLuVKW0IR1yEr9iqYK6UFN/f5q KJYbGvjJDx8MtCT7wcg3miu2vfdHSg4FM8iD1PxIgBfdGVXYy/1g25L21Lb4oRgdjyTq xbwA== X-Gm-Message-State: APjAAAWsIyTU2kV+qpWHXpj6pXyadVSvrnTtQUwvVQ4fP4WxxptEJ4JT lcQkRaAmIhnDaqAmAOucsE4VtCI= X-Google-Smtp-Source: APXvYqzqcHTvl8HZFP0nvzP+t5CSOnFvafWD743UFhQryJm5AcYhRHryM1ns4wZYEpBvCGeIyGJvkA== X-Received: by 2002:a02:a812:: with SMTP id f18mr18139260jaj.1.1566077087546; Sat, 17 Aug 2019 14:24:47 -0700 (PDT) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id q3sm4609806ios.70.2019.08.17.14.24.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 14:24:46 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 4/8] SUNRPC: Don't handle errors if the bind/connect succeeded Date: Sat, 17 Aug 2019 17:22:13 -0400 Message-Id: <20190817212217.22766-4-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190817212217.22766-3-trond.myklebust@hammerspace.com> References: <20190817212217.22766-1-trond.myklebust@hammerspace.com> <20190817212217.22766-2-trond.myklebust@hammerspace.com> <20190817212217.22766-3-trond.myklebust@hammerspace.com> 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 Don't handle errors in call_bind_status()/call_connect_status() if it turns out that a previous call caused it to succeed. Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v5.1+ --- net/sunrpc/clnt.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index d8679b6027e9..92c1c4e02855 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -1970,6 +1970,7 @@ call_bind(struct rpc_task *task) static void call_bind_status(struct rpc_task *task) { + struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt; int status = -EIO; if (rpc_task_transmitted(task)) { @@ -1977,14 +1978,13 @@ call_bind_status(struct rpc_task *task) return; } - if (task->tk_status >= 0) { - dprint_status(task); - task->tk_status = 0; + dprint_status(task); + trace_rpc_bind_status(task); + if (task->tk_status >= 0 || xprt_bound(xprt)) { task->tk_action = call_connect; return; } - trace_rpc_bind_status(task); switch (task->tk_status) { case -ENOMEM: dprintk("RPC: %5u rpcbind out of memory\n", task->tk_pid); @@ -2043,7 +2043,6 @@ call_bind_status(struct rpc_task *task) rpc_call_rpcerror(task, status); return; - retry_timeout: task->tk_status = 0; task->tk_action = call_bind; @@ -2090,6 +2089,7 @@ call_connect(struct rpc_task *task) static void call_connect_status(struct rpc_task *task) { + struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt; struct rpc_clnt *clnt = task->tk_client; int status = task->tk_status; @@ -2099,8 +2099,15 @@ call_connect_status(struct rpc_task *task) } dprint_status(task); - trace_rpc_connect_status(task); + + if (task->tk_status == 0) { + clnt->cl_stats->netreconn++; + goto out_next; + } + if (xprt_connected(xprt)) + goto out_next; + task->tk_status = 0; switch (status) { case -ECONNREFUSED: @@ -2131,13 +2138,12 @@ call_connect_status(struct rpc_task *task) case -EAGAIN: case -ETIMEDOUT: goto out_retry; - case 0: - clnt->cl_stats->netreconn++; - task->tk_action = call_transmit; - return; } rpc_call_rpcerror(task, status); return; +out_next: + task->tk_action = call_transmit; + return; out_retry: /* Check for timeouts before looping back to call_bind */ task->tk_action = call_bind; From patchwork Sat Aug 17 21:22:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11099309 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 5B6E7112C for ; Sat, 17 Aug 2019 21:24:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CADE28305 for ; Sat, 17 Aug 2019 21:24:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 414DA2890E; Sat, 17 Aug 2019 21:24:51 +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 E8AE428305 for ; Sat, 17 Aug 2019 21:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726265AbfHQVYu (ORCPT ); Sat, 17 Aug 2019 17:24:50 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:40434 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbfHQVYu (ORCPT ); Sat, 17 Aug 2019 17:24:50 -0400 Received: by mail-io1-f68.google.com with SMTP id t6so13265624ios.7 for ; Sat, 17 Aug 2019 14:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EhEBJdpP5k31PHfmwaToO18TZhBuyHdwYIsFCHVfDjU=; b=Xd9cppub6RVxyLd4gh8KYd90CRHX16dDr3hi5UMfwbeMnNd9+AHMGwGzmcszVop2AI PkcSZC2wxgiEpC/iJfObuvo65kpXifkakoIR5hvCsKDYa3GhDNRBM0yCEJaEdhgwfmri YjOakeWQjTvSRac7nBFy2DHyBQgikASJ03sKhXolN5xrMRgzA5Z1NPQaebd+Btdc67z7 xbgxpqP1kxuCToZfbKRaveQLDvLMwLIXNUQb+jXxdhR2lxtwN4aKhcj1JvS1MfiEkO9y ySUswXXr9f7HDTHikjxW8oUhHXaKAD5/B+XaK/8tKE1nDlVgU3uirZj8qUrYZMErh62N IBmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EhEBJdpP5k31PHfmwaToO18TZhBuyHdwYIsFCHVfDjU=; b=tMgH2xjWNY0TM8fkCJc1+i1zcPN2inYt+LbPm7nFa8Q9iOsiLVm03WMW4LDpKqfiQI MPgjq9T+TaS1YpvYbZ3eeCxum9LsWUZ4z8poY+N2DTA+X87He1bY8cEhU/5/nxIn8a4T I8hlHOgTlxC2tzUQ1MNik0aba4B11K7YQP4c4eyTPFrJx1JucP8bSuXBPV6xnCGvDs2m rOnVkS32oH4aYmxdcZnnW7wwGtfO0aNSdMIMWC/j5Kxpmm1Ny0vCEAod1mbqRK9pJMPx aoju/rCgSSLSKVLhgJngG4xFiG1TNvelMRsDLt8ApPb6wQCfMFFAwu4XBRHlVxObZ6Lp 3Q1w== X-Gm-Message-State: APjAAAVly86+wFA4MoTZ5Od+VlzpQRsumwW18JHUhw7xgXs72pwlt9+2 wk1Ga5dp4H8L+AzY3/KmBo2ghMI= X-Google-Smtp-Source: APXvYqzDLhbYtT4oFqow3dxK94rfthW36pYWdXI75fANZa8zd1QN8SoLFaWTWXLizzKNMDbRPVYhmQ== X-Received: by 2002:a02:7121:: with SMTP id n33mr17386284jac.19.1566077088729; Sat, 17 Aug 2019 14:24:48 -0700 (PDT) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id q3sm4609806ios.70.2019.08.17.14.24.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 14:24:47 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 5/8] pNFS/flexfiles: Turn off soft RPC calls Date: Sat, 17 Aug 2019 17:22:14 -0400 Message-Id: <20190817212217.22766-5-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190817212217.22766-4-trond.myklebust@hammerspace.com> References: <20190817212217.22766-1-trond.myklebust@hammerspace.com> <20190817212217.22766-2-trond.myklebust@hammerspace.com> <20190817212217.22766-3-trond.myklebust@hammerspace.com> <20190817212217.22766-4-trond.myklebust@hammerspace.com> 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 The pNFS/flexfiles I/O requests are sent with the SOFTCONN flag set, so they automatically time out if the connection breaks. It should therefore not be necessary to have the soft flag set in addition. Fixes: 5f01d9539496 ("nfs41: create NFSv3 DS connection if specified") Signed-off-by: Trond Myklebust --- fs/nfs/pnfs_nfs.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c index c0046c348910..82af4809b869 100644 --- a/fs/nfs/pnfs_nfs.c +++ b/fs/nfs/pnfs_nfs.c @@ -627,11 +627,16 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv, /* Add this address as an alias */ rpc_clnt_add_xprt(clp->cl_rpcclient, &xprt_args, rpc_clnt_test_and_add_xprt, NULL); - } else - clp = get_v3_ds_connect(mds_srv, - (struct sockaddr *)&da->da_addr, - da->da_addrlen, IPPROTO_TCP, - timeo, retrans); + continue; + } + clp = get_v3_ds_connect(mds_srv, + (struct sockaddr *)&da->da_addr, + da->da_addrlen, IPPROTO_TCP, + timeo, retrans); + if (IS_ERR(clp)) + continue; + clp->cl_rpcclient->cl_softerr = 0; + clp->cl_rpcclient->cl_softrtry = 0; } if (IS_ERR(clp)) { From patchwork Sat Aug 17 21:22:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11099311 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 6C8B8112C for ; Sat, 17 Aug 2019 21:24:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E47128305 for ; Sat, 17 Aug 2019 21:24:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FFED2890E; Sat, 17 Aug 2019 21:24:52 +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 EE58428305 for ; Sat, 17 Aug 2019 21:24:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726286AbfHQVYv (ORCPT ); Sat, 17 Aug 2019 17:24:51 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:38421 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbfHQVYv (ORCPT ); Sat, 17 Aug 2019 17:24:51 -0400 Received: by mail-io1-f65.google.com with SMTP id j6so13240608ioa.5 for ; Sat, 17 Aug 2019 14:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=J21Bur1x+P3o8AX2PJsmRWSsWPHyHWcs5Xd+2VCbJJI=; b=qGgpawi94Hf7IsduWWZq66SeIl5ua/ZTJKQFR85XlXJUVD0gUaPBkqICY0apIUJ5kP DkYzmGe+uTVL25nP1RK6yp09iT+60zrZk9pmHYdIvWEVAPfbBK6NUT6JMU5jRGQ1gpWG EVXV/5zIzX4LrtAWIp5y2/bsrFnmwBGaGhz37qxtWJ/Oczhq+VlV4cdtj4X+k+NWpk3y ypq5X/LV09r2+o3xz/wg1WfBQTaNER3hzN+EhMWt8XDtp+kwd/7fZiG65snz8gRyk7dn Addoj2Qkj6n0IK8YKEXvgolUm62I6oJ4vp5eEk5pjAh7NLrmTADrd5ikzBdMZlVzGJdb EkXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J21Bur1x+P3o8AX2PJsmRWSsWPHyHWcs5Xd+2VCbJJI=; b=eWN9o2q6g9VyfUoU105z4YsAWJ3/qx/B5b3LYhUDRLcuYmrmCI47GgedOaJAVTWrBw /luTd9zfCnc6P7QtLkduJY+bmZ8qnFrpvKtnoPgdNmTuxU4+8/Md5C4UL9lrhMw4Y7ef 2k5dI/cWC6rdmwhTkNFtgWYoLNJmiBghbzWt6p2fWk6jRUcmLGqsG/EnrvweVpY7xOV8 ocWO+MvUTY0Wtpe5o1sFAgiDKvmJ4iKzKHhRVrQjGGAErLT2RFMCiV8UHVajLsLgbuBy qsNb+FTE5O/6k+NqcI+HY4DvfKD/qBHTrCXwtMhgEunabjL7DmlDXhifUP2Pr7Sbl4vL hctQ== X-Gm-Message-State: APjAAAWC4Xb2kbJKdaHeFQncuz62qmRlqPCOx45h1sYvv8xtxkWhCetV JSd+gSTxkcJHH/Ff+ZAdJMmeObs= X-Google-Smtp-Source: APXvYqy/VQWdKTVNGJ1C5jlBnUuDl/Vr1D6S0GJQ2H9uTVNeGPxiw4fxT6aevUZ45OhiYBJ96XjdbQ== X-Received: by 2002:a5d:824e:: with SMTP id n14mr5186300ioo.205.1566077089819; Sat, 17 Aug 2019 14:24:49 -0700 (PDT) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id q3sm4609806ios.70.2019.08.17.14.24.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 14:24:49 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 6/8] SUNRPC: Handle EADDRINUSE and ENOBUFS correctly Date: Sat, 17 Aug 2019 17:22:15 -0400 Message-Id: <20190817212217.22766-6-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190817212217.22766-5-trond.myklebust@hammerspace.com> References: <20190817212217.22766-1-trond.myklebust@hammerspace.com> <20190817212217.22766-2-trond.myklebust@hammerspace.com> <20190817212217.22766-3-trond.myklebust@hammerspace.com> <20190817212217.22766-4-trond.myklebust@hammerspace.com> <20190817212217.22766-5-trond.myklebust@hammerspace.com> 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 If a connect or bind attempt returns EADDRINUSE, that means we want to retry with a different port. It is not a fatal connection error. Similarly, ENOBUFS is not fatal, but just indicates a memory allocation issue. Retry after a short delay. Signed-off-by: Trond Myklebust --- net/sunrpc/clnt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 92c1c4e02855..9546a4c72838 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2003,6 +2003,9 @@ call_bind_status(struct rpc_task *task) task->tk_rebind_retry--; rpc_delay(task, 3*HZ); goto retry_timeout; + case -ENOBUFS: + rpc_delay(task, HZ >> 2); + goto retry_timeout; case -EAGAIN: goto retry_timeout; case -ETIMEDOUT: @@ -2026,7 +2029,6 @@ call_bind_status(struct rpc_task *task) case -ENETDOWN: case -EHOSTUNREACH: case -ENETUNREACH: - case -ENOBUFS: case -EPIPE: dprintk("RPC: %5u remote rpcbind unreachable: %d\n", task->tk_pid, task->tk_status); @@ -2124,8 +2126,6 @@ call_connect_status(struct rpc_task *task) case -ENETDOWN: case -ENETUNREACH: case -EHOSTUNREACH: - case -EADDRINUSE: - case -ENOBUFS: case -EPIPE: xprt_conditional_disconnect(task->tk_rqstp->rq_xprt, task->tk_rqstp->rq_connect_cookie); @@ -2134,10 +2134,14 @@ call_connect_status(struct rpc_task *task) /* retry with existing socket, after a delay */ rpc_delay(task, 3*HZ); /* fall through */ + case -EADDRINUSE: case -ENOTCONN: case -EAGAIN: case -ETIMEDOUT: goto out_retry; + case -ENOBUFS: + rpc_delay(task, HZ >> 2); + goto out_retry; } rpc_call_rpcerror(task, status); return; From patchwork Sat Aug 17 21:22:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11099315 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 1EEAE56FE for ; Sat, 17 Aug 2019 21:24:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10A6128305 for ; Sat, 17 Aug 2019 21:24:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04DDF2890E; Sat, 17 Aug 2019 21:24:54 +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 89B2A28305 for ; Sat, 17 Aug 2019 21:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726294AbfHQVYx (ORCPT ); Sat, 17 Aug 2019 17:24:53 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:44960 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbfHQVYw (ORCPT ); Sat, 17 Aug 2019 17:24:52 -0400 Received: by mail-io1-f67.google.com with SMTP id j4so13251013iop.11 for ; Sat, 17 Aug 2019 14:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1Wa20v9DOwhTLOoklk7B249Gl+XVh94Z1PjBBWmbtMI=; b=GB5IeCplcOsZV+u2lhozqOEjlfAOlMnbNPfW7zsYsZ3UqWxE33zUzszRjefIdzKeLK 0wRCflse6Ih38iWi29tCn2BW1WHvMxvVNZj566RXci/Ua4VlXBR8HZ6Z9g2/IOs5MVrY QAeMQ86714FBIvth5TxX9XtZaOWQ8A40VkVzFx5d0YCWN9hGxlfUj6jodgAPbdJNrdas KHogEBiFzw76u+8P8uVztqfYDLG8ydwkXeaqo7t4EdNXjG1OClKt3vocnWXEXeO6FCng CDnt2HhdL4LKQJnDpxfr2pKeHnfTIzoKYLbBJBeMjjYlmOGFRehfXWaZim0eNPpStOcQ m1cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1Wa20v9DOwhTLOoklk7B249Gl+XVh94Z1PjBBWmbtMI=; b=cbdPmc8v6sBVsYHDoM09zkuIYScz+ybwbHwSjHJhDqIaZobkYoraPLl2pwrAnpbFSD s28bz/gvpPcSvYGt+VUv9Sa8By4yxbrqGfLlKpOkNqok1Lx5Ge5KSG/u3zfpSr7r8g4n RVNJUDKmk5Ue8M2aM1CGaiqvnrJTkP6A3wXfXvFxKd58+p+YpZqQLG9Uemo3CZUed+06 UbMt2JR3WLGhcdNJ9CAV0WCEGOGHT9c7Pn9xbbqbF2kSXPINYaLjpcJW8B684wsZDoT1 Ra+uMZNnv8n1IzvlQy6ZIgS4pagbAqgXY15xwkLVtz2oiurBAMfjnpnNBxE0vJNPHHt/ azpA== X-Gm-Message-State: APjAAAXDqwWgzu6HPF7fLg+7wEGhns3rEvOYco26sRDTZIi8BKnOAKpI lOp19dLxehV3UqIgPenE7XBgprE= X-Google-Smtp-Source: APXvYqzOeuEZLsUSv+aCU50/c+0vx5Sbd5YL0kuKgAs6PXTc+7M+hzuwy2lCnc1av5Kbja0ElvEzzA== X-Received: by 2002:a5d:8ad0:: with SMTP id e16mr15611297iot.262.1566077090737; Sat, 17 Aug 2019 14:24:50 -0700 (PDT) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id q3sm4609806ios.70.2019.08.17.14.24.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 14:24:50 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 7/8] Revert "NFSv4/flexfiles: Abort I/O early if the layout segment was invalidated" Date: Sat, 17 Aug 2019 17:22:16 -0400 Message-Id: <20190817212217.22766-7-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190817212217.22766-6-trond.myklebust@hammerspace.com> References: <20190817212217.22766-1-trond.myklebust@hammerspace.com> <20190817212217.22766-2-trond.myklebust@hammerspace.com> <20190817212217.22766-3-trond.myklebust@hammerspace.com> <20190817212217.22766-4-trond.myklebust@hammerspace.com> <20190817212217.22766-5-trond.myklebust@hammerspace.com> <20190817212217.22766-6-trond.myklebust@hammerspace.com> 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 This reverts commit a79f194aa4879e9baad118c3f8bb2ca24dbef765. The mechanism for aborting I/O is racy, since we are not guaranteed that the request is asleep while we're changing both task->tk_status and task->tk_action. Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v5.1 --- fs/nfs/flexfilelayout/flexfilelayout.c | 17 ----------------- include/linux/sunrpc/sched.h | 1 - net/sunrpc/xprt.c | 7 ------- 3 files changed, 25 deletions(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index b04e20d28162..2c7e1eca1ed7 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -1148,8 +1148,6 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task, break; case -NFS4ERR_RETRY_UNCACHED_REP: break; - case -EAGAIN: - return -NFS4ERR_RESET_TO_PNFS; /* Invalidate Layout errors */ case -NFS4ERR_PNFS_NO_LAYOUT: case -ESTALE: /* mapped NFS4ERR_STALE */ @@ -1210,7 +1208,6 @@ static int ff_layout_async_handle_error_v3(struct rpc_task *task, case -EBADHANDLE: case -ELOOP: case -ENOSPC: - case -EAGAIN: break; case -EJUKEBOX: nfs_inc_stats(lseg->pls_layout->plh_inode, NFSIOS_DELAY); @@ -1445,16 +1442,6 @@ static void ff_layout_read_prepare_v4(struct rpc_task *task, void *data) ff_layout_read_prepare_common(task, hdr); } -static void -ff_layout_io_prepare_transmit(struct rpc_task *task, - void *data) -{ - struct nfs_pgio_header *hdr = data; - - if (!pnfs_is_valid_lseg(hdr->lseg)) - rpc_exit(task, -EAGAIN); -} - static void ff_layout_read_call_done(struct rpc_task *task, void *data) { struct nfs_pgio_header *hdr = data; @@ -1740,7 +1727,6 @@ static void ff_layout_commit_release(void *data) static const struct rpc_call_ops ff_layout_read_call_ops_v3 = { .rpc_call_prepare = ff_layout_read_prepare_v3, - .rpc_call_prepare_transmit = ff_layout_io_prepare_transmit, .rpc_call_done = ff_layout_read_call_done, .rpc_count_stats = ff_layout_read_count_stats, .rpc_release = ff_layout_read_release, @@ -1748,7 +1734,6 @@ static const struct rpc_call_ops ff_layout_read_call_ops_v3 = { static const struct rpc_call_ops ff_layout_read_call_ops_v4 = { .rpc_call_prepare = ff_layout_read_prepare_v4, - .rpc_call_prepare_transmit = ff_layout_io_prepare_transmit, .rpc_call_done = ff_layout_read_call_done, .rpc_count_stats = ff_layout_read_count_stats, .rpc_release = ff_layout_read_release, @@ -1756,7 +1741,6 @@ static const struct rpc_call_ops ff_layout_read_call_ops_v4 = { static const struct rpc_call_ops ff_layout_write_call_ops_v3 = { .rpc_call_prepare = ff_layout_write_prepare_v3, - .rpc_call_prepare_transmit = ff_layout_io_prepare_transmit, .rpc_call_done = ff_layout_write_call_done, .rpc_count_stats = ff_layout_write_count_stats, .rpc_release = ff_layout_write_release, @@ -1764,7 +1748,6 @@ static const struct rpc_call_ops ff_layout_write_call_ops_v3 = { static const struct rpc_call_ops ff_layout_write_call_ops_v4 = { .rpc_call_prepare = ff_layout_write_prepare_v4, - .rpc_call_prepare_transmit = ff_layout_io_prepare_transmit, .rpc_call_done = ff_layout_write_call_done, .rpc_count_stats = ff_layout_write_count_stats, .rpc_release = ff_layout_write_release, diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index baa3ecdb882f..27536b961552 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -98,7 +98,6 @@ typedef void (*rpc_action)(struct rpc_task *); struct rpc_call_ops { void (*rpc_call_prepare)(struct rpc_task *, void *); - void (*rpc_call_prepare_transmit)(struct rpc_task *, void *); void (*rpc_call_done)(struct rpc_task *, void *); void (*rpc_count_stats)(struct rpc_task *, void *); void (*rpc_release)(void *); diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 783748dc5e6f..2e71f5455c6c 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -1408,13 +1408,6 @@ xprt_request_transmit(struct rpc_rqst *req, struct rpc_task *snd_task) status = -EBADMSG; goto out_dequeue; } - if (task->tk_ops->rpc_call_prepare_transmit) { - task->tk_ops->rpc_call_prepare_transmit(task, - task->tk_calldata); - status = task->tk_status; - if (status < 0) - goto out_dequeue; - } if (RPC_SIGNALLED(task)) { status = -ERESTARTSYS; goto out_dequeue; From patchwork Sat Aug 17 21:22:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11099313 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 9F42418EC for ; Sat, 17 Aug 2019 21:24:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9146B2890B for ; Sat, 17 Aug 2019 21:24:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85BFC2890E; Sat, 17 Aug 2019 21:24:53 +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 3449528305 for ; Sat, 17 Aug 2019 21:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726298AbfHQVYw (ORCPT ); Sat, 17 Aug 2019 17:24:52 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:46336 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726294AbfHQVYw (ORCPT ); Sat, 17 Aug 2019 17:24:52 -0400 Received: by mail-io1-f68.google.com with SMTP id x4so13212813iog.13 for ; Sat, 17 Aug 2019 14:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NeLO9jdAeEyl4NgS+9idWVlbfcyG6zf1VXRk6Y/uR1M=; b=O6y0uzD4tTxXFHHO+tSseldEe0p9sWpCyxvuKXxKWGHShBr8vj2ijR8mzViLGdZM9C 59WeBBaleFDQodN9Ai5wyLeUzq+qdDedO/0w91hWrc/fF4NVxQypUMIYY9/U9Z67rt53 eqxMjPojqGV8F6B3ZxYTImidk1eiYatIjwOnp9wFVa9ZAN34I9SfIC3fcayRDB8rnNLX G6E5Zw+jvJjwSFgeDTbUPFXvdi+hFAFbDagj18g5GBszKA8OkcAknHcAHS4dKLhOyHKi ZP/hy1XRB77N41hNx5evSO3lBb90U1qbdMmoKloh2TIswBUrc1knzL4X3SdrO7yjNzl0 PPfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NeLO9jdAeEyl4NgS+9idWVlbfcyG6zf1VXRk6Y/uR1M=; b=DXa/eRt+wbiIeBmu3P3SZD77TVbIdJXrt67dqjhkqFNFl3ZUeR6WgwB8pcrmnaRTs9 TSFWznqha6nfZzXdo1nZJwQb0wk696z1ixepGeBgYQ6jlpx690gWc3i2+xSaISyeKbBM gActUggCWSfbEBK5PWrNdXto5rgzPkwFmd3P82rOQcClvu6UU2XwRsXZIVLxjaZx/Muy xoT1Aj1n5cY9U6hKbufo68zYF79+7s1eBc3yXhFwTzBXWvmNI/4GiuYbE2MqTtf1uLYc ErG1Vnb2RAPaiBpMkCe/WPMjbDj6Zi7mumInDsWDsf97/4VOtBAOLgacPksnIveQVqj2 8Ayg== X-Gm-Message-State: APjAAAXqqe3DpxqaSojz8pXbE8h12TauTLTEg5g9AApilz0Kz4PabV1A hv005H5lT2GMUOUiBfcgTEOsiSI= X-Google-Smtp-Source: APXvYqz2+BlXgDb5FRLX8XHn4dLC6a1V8LYhtYuqXDYc/EBfYQDQ0sOuSAjulbFfcnt7uAwB6nxl6Q== X-Received: by 2002:a5d:9583:: with SMTP id a3mr17751049ioo.54.1566077091423; Sat, 17 Aug 2019 14:24:51 -0700 (PDT) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id q3sm4609806ios.70.2019.08.17.14.24.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 14:24:50 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 8/8] SUNRPC: Handle connection breakages correctly in call_status() Date: Sat, 17 Aug 2019 17:22:17 -0400 Message-Id: <20190817212217.22766-8-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190817212217.22766-7-trond.myklebust@hammerspace.com> References: <20190817212217.22766-1-trond.myklebust@hammerspace.com> <20190817212217.22766-2-trond.myklebust@hammerspace.com> <20190817212217.22766-3-trond.myklebust@hammerspace.com> <20190817212217.22766-4-trond.myklebust@hammerspace.com> <20190817212217.22766-5-trond.myklebust@hammerspace.com> <20190817212217.22766-6-trond.myklebust@hammerspace.com> <20190817212217.22766-7-trond.myklebust@hammerspace.com> 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 If the connection breaks while we're waiting for a reply from the server, then we want to immediately try to reconnect. Fixes: ec6017d90359 ("SUNRPC fix regression in umount of a secure mount") Signed-off-by: Trond Myklebust --- net/sunrpc/clnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 9546a4c72838..f13ec73c8299 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2375,7 +2375,7 @@ call_status(struct rpc_task *task) case -ECONNABORTED: case -ENOTCONN: rpc_force_rebind(clnt); - /* fall through */ + break; case -EADDRINUSE: rpc_delay(task, 3*HZ); /* fall through */