From patchwork Tue Feb 19 13:53:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10819917 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 C2BAB1805 for ; Tue, 19 Feb 2019 13:55:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B105428A0D for ; Tue, 19 Feb 2019 13:55:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A42B32990F; Tue, 19 Feb 2019 13:55:17 +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 431632A7CE for ; Tue, 19 Feb 2019 13:55:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726221AbfBSNzQ (ORCPT ); Tue, 19 Feb 2019 08:55:16 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:53562 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbfBSNzQ (ORCPT ); Tue, 19 Feb 2019 08:55:16 -0500 Received: by mail-it1-f196.google.com with SMTP id x131so6131558itc.3 for ; Tue, 19 Feb 2019 05:55:15 -0800 (PST) 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=1rEZ/xqNSEhTI7upYi3VMhoDwpPz/PE6FG7J3ekDwQI=; b=WzZ4nq4Q+YRY+cOJ4RCmWO51NtqeFXsnS5h6mjfp4wCAF2xlhjsvU0ScoWiIiAn+BN p3kD6I6FqtTamr5zl8+/xowCzL1leZvpVCZbuIfqhErTU3y7JkYmG/xKohdm3mdtvJVC 5yK69DPL2fsZol2C5GplIW7SgP4PPMVuDqIWVemfEWcIXv6dlShlFxYZMrELERhekYep JEmsRg9WC2i6MtnqvoveXFHvWAZfHZ0uyjsJEr2K+yYLhz0k9etUBiRnuIPRzEsJK/nA RGMIYS3rhsuqQdXw6ccuCQtdszoa0T4OIfKKPQH5PJ9YklJuc/lDnfQF1grlTDxQWJ1i IesQ== 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=1rEZ/xqNSEhTI7upYi3VMhoDwpPz/PE6FG7J3ekDwQI=; b=VtkFHd3N4P6W1qV5dqGwmoB0WxwRHROarRWGXcJKM6pP9WhiX9nY+E90i5a2NsRFLw xedlh1S61z+l9yojGJdZhYaljnlUOzlyxjlj/OXDIJDdnb3eL8/+AqlhXhHfjCnAv7Yd 3iWHqLlkaqNg/wVTAQa/M4ffR2KW9zxiIFLbfswn0dZpz/byFBq0andV9JibNRsCBCKu it69pEuzLAomogPHsMGgrbf737whkSuWB2MDGx1EuxT1PcjMy2R+5vae+MobUA/L2+hz 4ZZ0fT7oDCdt5wUTR9DvCk6Z2elf6sD1WQm6uOZYM0hc6626RFwA3D5hefQQWp2nYRxp 4byw== X-Gm-Message-State: AHQUAuYjPD5F2fluIDpjo5ppgZxzsi9CDyYNABC53BPxNR+JmZ5FkpIC cro170ns28R7/1fny96YsxG4E64= X-Google-Smtp-Source: AHgI3IZvmzS6wtyrWynlOSzzrpFIgV/b2UUfgmLEjFNADoJyVehAu+cGuzJM/CiQMolhhi7qtCGGNw== X-Received: by 2002:a24:3512:: with SMTP id k18mr2042055ita.83.1550584514933; Tue, 19 Feb 2019 05:55:14 -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 c133sm1196313itc.24.2019.02.19.05.55.13 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 05:55:13 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v3 1/8] NFS: Fix I/O request leakages Date: Tue, 19 Feb 2019 08:53:04 -0500 Message-Id: <20190219135311.119300-2-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190219135311.119300-1-trond.myklebust@hammerspace.com> References: <20190219135311.119300-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 When we fail to add the request to the I/O queue, we currently leave it to the caller to free the failed request. However since some of the requests that fail are actually created by nfs_pageio_add_request() itself, and are not passed back the caller, this leads to a leakage issue, which can again cause page locks to leak. This commit addresses the leakage by freeing the created requests on error, using desc->pg_completion_ops->error_cleanup() Signed-off-by: Trond Myklebust Fixes: a7d42ddb30997 ("nfs: add mirroring support to pgio layer") Cc: stable@vger.kernel.org # v4.0: c18b96a1b862: nfs: clean up rest of reqs Cc: stable@vger.kernel.org # v4.0: d600ad1f2bdb: NFS41: pop some layoutget Cc: stable@vger.kernel.org # v4.0+ --- fs/nfs/pagelist.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index e54d899c1848..301880a3ad8e 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -988,6 +988,17 @@ static void nfs_pageio_doio(struct nfs_pageio_descriptor *desc) } } +static void +nfs_pageio_cleanup_request(struct nfs_pageio_descriptor *desc, + struct nfs_page *req) +{ + LIST_HEAD(head); + + nfs_list_remove_request(req); + nfs_list_add_request(req, &head); + desc->pg_completion_ops->error_cleanup(&head); +} + /** * nfs_pageio_add_request - Attempt to coalesce a request into a page list. * @desc: destination io descriptor @@ -1025,10 +1036,8 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, nfs_page_group_unlock(req); desc->pg_moreio = 1; nfs_pageio_doio(desc); - if (desc->pg_error < 0) - return 0; - if (mirror->pg_recoalesce) - return 0; + if (desc->pg_error < 0 || mirror->pg_recoalesce) + goto out_cleanup_subreq; /* retry add_request for this subreq */ nfs_page_group_lock(req); continue; @@ -1061,6 +1070,10 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, desc->pg_error = PTR_ERR(subreq); nfs_page_group_unlock(req); return 0; +out_cleanup_subreq: + if (req != subreq) + nfs_pageio_cleanup_request(desc, subreq); + return 0; } static int nfs_do_recoalesce(struct nfs_pageio_descriptor *desc) @@ -1168,11 +1181,14 @@ int nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, if (nfs_pgio_has_mirroring(desc)) desc->pg_mirror_idx = midx; if (!nfs_pageio_add_request_mirror(desc, dupreq)) - goto out_failed; + goto out_cleanup_subreq; } return 1; +out_cleanup_subreq: + if (req != dupreq) + nfs_pageio_cleanup_request(desc, dupreq); out_failed: nfs_pageio_error_cleanup(desc); return 0; From patchwork Tue Feb 19 13:53:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10819919 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 791396CB for ; Tue, 19 Feb 2019 13:55:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6752D28A0D for ; Tue, 19 Feb 2019 13:55:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B90B299F2; Tue, 19 Feb 2019 13:55:18 +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 10E0D28A0D for ; Tue, 19 Feb 2019 13:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726384AbfBSNzR (ORCPT ); Tue, 19 Feb 2019 08:55:17 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:35122 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725794AbfBSNzR (ORCPT ); Tue, 19 Feb 2019 08:55:17 -0500 Received: by mail-it1-f193.google.com with SMTP id v72so6329886itc.0 for ; Tue, 19 Feb 2019 05:55:16 -0800 (PST) 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=njCUfkgXUj/lPfViFXNEQbF8PDFKgBs5hgYZS/IoSVw=; b=FaLjLu4xMKqMkPCuTEJ36ptHJrCrHxoM5Mk0M0ZMiE1hGH9kdYZFsGgiAFhM9RzYYZ J7Amymo8OZ+PvoMdP7vjMK7vBNWu1w/gopimyqZefVLNcI6NG0d2VxCD6fpxOBmsdXXP DqZO5duF2O6UQ7Anrj4CzMRMeStet92nUgDqGu6/v/CaUM/ocuUnm/dNiVqcPoeATCjF F7hkcATqKDtmPTtlCSNn/XMt9UEW/QTZpqoxp+Sa2oDp81zgObQSuMI4EM3v5IxE0mCM NiLapkvpMzZEwmnPVW0ROj3kiwNVLAks88wRRRG2SaxwONWsNfgjCqRM/6Z8iMiFs+sv 2Gjw== 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=njCUfkgXUj/lPfViFXNEQbF8PDFKgBs5hgYZS/IoSVw=; b=k/i3QsDK46TRirQuMyKrkloguw2mxHpylhDweTAs56ycBWqXCXyUrlrISCPDtifhtE AinlKXwzxFH/jHzwFW2GaOQKn2BwLU6c1kuW0eRgk82DMCgqep4gyXJr6whINKMHjSVQ BAGH8jZ7mmGDHED3EwGcKX2mQ01O7olK/ikPkh2dk06cO7el9YXllYhK2Pazm6ful94C SWElOGZt2vK3ftjaonUOVSvgPLGQ37Ur7yOuiFbMp3on4FX3fxeNF08dp3kdtZMxvX+q hvg2j7ZFlBjk9E2ydL04RcrgufD4qsz5Gxg1AjRiUHijCvbDNZ6iirNdBvT9xzXHkuwf t1Lw== X-Gm-Message-State: AHQUAuaC0HXZM0X5HO6gckvxytGMNxteINa6+j6CtiSPo6qbqSwUP5oN 7Vnlt0rmofE31uM9Z/Zu1qbSohU= X-Google-Smtp-Source: AHgI3Iba/lPxgXaWYVuzWFq8+Bx3j+wX2SBnie/OyUlUbRsTH7hozmjTjBY1pXxrxaWQ5kKYbjefdQ== X-Received: by 2002:a05:6638:398:: with SMTP id y24mr5455491jap.33.1550584515749; Tue, 19 Feb 2019 05:55:15 -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 c133sm1196313itc.24.2019.02.19.05.55.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 05:55:15 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v3 2/8] NFS: Fix an I/O request leakage in nfs_do_recoalesce Date: Tue, 19 Feb 2019 08:53:05 -0500 Message-Id: <20190219135311.119300-3-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190219135311.119300-2-trond.myklebust@hammerspace.com> References: <20190219135311.119300-1-trond.myklebust@hammerspace.com> <20190219135311.119300-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 Whether we need to exit early, or just reprocess the list, we must not lost track of the request which failed to get recoalesced. Fixes: 03d5eb65b538 ("NFS: Fix a memory leak in nfs_do_recoalesce") Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v4.0+ --- fs/nfs/pagelist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 301880a3ad8e..03bde9a41451 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1092,7 +1092,6 @@ static int nfs_do_recoalesce(struct nfs_pageio_descriptor *desc) struct nfs_page *req; req = list_first_entry(&head, struct nfs_page, wb_list); - nfs_list_remove_request(req); if (__nfs_pageio_add_request(desc, req)) continue; if (desc->pg_error < 0) { From patchwork Tue Feb 19 13:53:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10819921 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 E1ED31805 for ; Tue, 19 Feb 2019 13:55:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE0B828A0D for ; Tue, 19 Feb 2019 13:55:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4B002990F; Tue, 19 Feb 2019 13:55:18 +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 6CCEC2A7CE for ; Tue, 19 Feb 2019 13:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725794AbfBSNzR (ORCPT ); Tue, 19 Feb 2019 08:55:17 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:36426 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbfBSNzR (ORCPT ); Tue, 19 Feb 2019 08:55:17 -0500 Received: by mail-it1-f193.google.com with SMTP id h6so6316830itl.1 for ; Tue, 19 Feb 2019 05:55:17 -0800 (PST) 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=wXjLTa00JtUj+bxtm/gQ5O9DQfSATWfqpQWj8DpjYoI=; b=gt+E61sDZv1olrmsclTkqYbE3/2MJTzCKttvSPkCLFyH0RanHX8tSt2NdVGCvWLi5Y Gw6TFgWt4VF+7fp449a4iClPX8C8aY9mxQjmGRCci+78uYB7w3liDhjGqqgRVigxEUjB NI0TUWA5hMLl3SILGEdYLJz6OZFmKCu9R468BDJx6oG3pUl9OkFHbaA3HGSB8TgM3C9t YfyKMTmmBu7lSQ08wH25Oru/MQ889xUw74xqV5L9H77h/+k90hc2JKunPP3Sfa+7Jxwj sLHU6vZaYE5EUkjptvxvx+lcK7SY0udrMn7YzVnlYPCYeo5QedUVbsq9hWA9BQnhWD8v NeCQ== 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=wXjLTa00JtUj+bxtm/gQ5O9DQfSATWfqpQWj8DpjYoI=; b=cjYmDu+Po6RCiLVOC7fxJwx6xoLp1DhHyQ/ZnMHv8y9Cm7NJkydAGEgJOfkv5veMJL XnbmrGLadRP2Bp/U3ukvuR+U6WjdoDrolmJVFLmTpCQbO3FTLFvHRNpFwzxhv0TpKYIA xu1js7hFktyKfZIZ+X585XlfE5hbIZrCqQ3et1v4AjYSI62eCNojf63tgmmXQDc4j7hI hvjo2uGqVM5vuVKlN0NkiTwZ+QzrE8uJEdqDRIirM1igxqe20djMlC4I3ikZ4L615914 EnfmepzlJ6WKpVFfri3Y5KSVXKJtLL0cDRdDMBpAiuC5ldniMc254j7IrzfCLxrNwyPO cm3Q== X-Gm-Message-State: AHQUAuaHNh6azpCGhJTPUUWbx8JHEcKXRHriVJQUDIR8f6wdckw2jx7z EsyJqCKs3v2AcuEIIi0LmS+8/ws= X-Google-Smtp-Source: AHgI3IbA3qSM3uviqm5eUU8ktv/Brmub9A59HzecXrGoC+dPuZVyM5sBAkEEA//8iTQgAwe8Qz98lw== X-Received: by 2002:a5d:9b0d:: with SMTP id y13mr20277556ion.112.1550584516463; Tue, 19 Feb 2019 05:55:16 -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 c133sm1196313itc.24.2019.02.19.05.55.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 05:55:15 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v3 3/8] NFS: Don't recoalesce on error in nfs_pageio_complete_mirror() Date: Tue, 19 Feb 2019 08:53:06 -0500 Message-Id: <20190219135311.119300-4-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190219135311.119300-3-trond.myklebust@hammerspace.com> References: <20190219135311.119300-1-trond.myklebust@hammerspace.com> <20190219135311.119300-2-trond.myklebust@hammerspace.com> <20190219135311.119300-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 If the I/O completion failed with a fatal error, then we should just exit nfs_pageio_complete_mirror() rather than try to recoalesce. Fixes: a7d42ddb3099 ("nfs: add mirroring support to pgio layer") Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v4.0+ --- 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 03bde9a41451..a8951f1f7b4e 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1209,7 +1209,7 @@ static void nfs_pageio_complete_mirror(struct nfs_pageio_descriptor *desc, desc->pg_mirror_idx = mirror_idx; for (;;) { nfs_pageio_doio(desc); - if (!mirror->pg_recoalesce) + if (desc->pg_error < 0 || !mirror->pg_recoalesce) break; if (!nfs_do_recoalesce(desc)) break; From patchwork Tue Feb 19 13:53:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10819929 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 102E41805 for ; Tue, 19 Feb 2019 13:55:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3D4328A0D for ; Tue, 19 Feb 2019 13:55:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8B412B151; Tue, 19 Feb 2019 13:55:22 +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 1D1B928A0D for ; Tue, 19 Feb 2019 13:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728589AbfBSNzT (ORCPT ); Tue, 19 Feb 2019 08:55:19 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:54316 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbfBSNzT (ORCPT ); Tue, 19 Feb 2019 08:55:19 -0500 Received: by mail-it1-f195.google.com with SMTP id f10so6112460ita.4 for ; Tue, 19 Feb 2019 05:55:18 -0800 (PST) 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=KvAVOpySW+nJNSDgsb4o9kSovq91vPpOtg04Xafg4Jg=; b=rVPIr01P1ND8LWrP1wJ9MFsv/jOZzduEJfuZJwRCp8qcL1YnEwobgdlTCTX/ZVhd4c 0KPF6jnEGSgBFQ+tEeBpxY3k/H3PusImxdSP+8bR6BXQ+HG+cuHq1GL3SNxZ5AVLsUJd T/tDVWJWy/qjZGyz/hGdk/5G4beUYz3bkppV16XZKEg+lfNqEbEN3E+nckr9KSrmigWc pzqWbP+4BKRi/b+zIUlAUCkVkIvsQzE6QvY75dg04BDrBiqmOKj0PkHvSaP4Gid1ltD1 HuBkXlWx4FbA+t8+vvxu/e/MsXlwHk6FP5a78NQb4ak1i25q+86AJxXusHLKNt9Lp+H3 If3g== 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=KvAVOpySW+nJNSDgsb4o9kSovq91vPpOtg04Xafg4Jg=; b=UATjs43q3fM/BiNdcs0APnnBXquV9nZQpE/itFbto0cv279FA+YJ3CUyrRYuetWM8f eraz9x3sagqjgEVMP7LTSCvBHL5RaU5URwbAwQNGfE+v0EhJiTJrd3HeaHitMiEuNz/+ k1QYZPtZb5gV/ZCI1smXhh+27a84q8Iw1NETWWBuc39zzbfDBhT8A8CuAWxO5W3uRJCR Xxr4ygXPzShm39/TdQhawaT4FmU38mF+ItSN9cV6aF1tF9GLhv7Iuug7eNgVt9oLbwbM J0sEg4wQFmek/6yF8XVUK3dCxx+ASXf3UY8iDqxENzxBIR9SCxSeQzptI000PPlA1V5f neag== X-Gm-Message-State: AHQUAubyaqTQYhzpl7oRpw5EQVvURfMYqS2EvDHIJPqQaN/COEmZ5o8/ 0jlylSTPY4tb3PwS3nk1XrCfvWo= X-Google-Smtp-Source: AHgI3IYXYA3T54gtl40qyIKLuJHWR+L+B4lF0x0MY22erIIC+5SOkqd2zyplTzaD4NFrN0TEPTab/Q== X-Received: by 2002:a5e:a607:: with SMTP id q7mr16757708ioi.15.1550584517725; Tue, 19 Feb 2019 05:55:17 -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 c133sm1196313itc.24.2019.02.19.05.55.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 05:55:17 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v3 4/8] NFS: Clean up list moves of struct nfs_page Date: Tue, 19 Feb 2019 08:53:07 -0500 Message-Id: <20190219135311.119300-5-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190219135311.119300-4-trond.myklebust@hammerspace.com> References: <20190219135311.119300-1-trond.myklebust@hammerspace.com> <20190219135311.119300-2-trond.myklebust@hammerspace.com> <20190219135311.119300-3-trond.myklebust@hammerspace.com> <20190219135311.119300-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 In several places we're just moving the struct nfs_page from one list to another by first removing from the existing list, then adding to the new one. Signed-off-by: Trond Myklebust --- fs/nfs/direct.c | 3 +-- fs/nfs/pagelist.c | 12 ++++-------- include/linux/nfs_page.h | 10 ++++++++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 33824a0a57bf..1377ee20ecf9 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -664,8 +664,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) list_for_each_entry_safe(req, tmp, &reqs, wb_list) { if (!nfs_pageio_add_request(&desc, req)) { - nfs_list_remove_request(req); - nfs_list_add_request(req, &failed); + nfs_list_move_request(req, &failed); spin_lock(&cinfo.inode->i_lock); dreq->flags = 0; if (desc.pg_error < 0) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index a8951f1f7b4e..9cbfdb979992 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -768,8 +768,7 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, pageused = 0; while (!list_empty(head)) { req = nfs_list_entry(head->next); - nfs_list_remove_request(req); - nfs_list_add_request(req, &hdr->pages); + nfs_list_move_request(req, &hdr->pages); if (!last_page || last_page != req->wb_page) { pageused++; @@ -961,8 +960,7 @@ static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc, } if (!nfs_can_coalesce_requests(prev, req, desc)) return 0; - nfs_list_remove_request(req); - nfs_list_add_request(req, &mirror->pg_list); + nfs_list_move_request(req, &mirror->pg_list); mirror->pg_count += req->wb_bytes; return 1; } @@ -994,8 +992,7 @@ nfs_pageio_cleanup_request(struct nfs_pageio_descriptor *desc, { LIST_HEAD(head); - nfs_list_remove_request(req); - nfs_list_add_request(req, &head); + nfs_list_move_request(req, &head); desc->pg_completion_ops->error_cleanup(&head); } @@ -1237,9 +1234,8 @@ int nfs_pageio_resend(struct nfs_pageio_descriptor *desc, while (!list_empty(&hdr->pages)) { struct nfs_page *req = nfs_list_entry(hdr->pages.next); - nfs_list_remove_request(req); if (!nfs_pageio_add_request(desc, req)) - nfs_list_add_request(req, &failed); + nfs_list_move_request(req, &failed); } nfs_pageio_complete(desc); if (!list_empty(&failed)) { diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index e27572d30d97..ad69430fd0eb 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h @@ -164,6 +164,16 @@ nfs_list_add_request(struct nfs_page *req, struct list_head *head) list_add_tail(&req->wb_list, head); } +/** + * nfs_list_move_request - Move a request to a new list + * @req: request + * @head: head of list into which to insert the request. + */ +static inline void +nfs_list_move_request(struct nfs_page *req, struct list_head *head) +{ + list_move_tail(&req->wb_list, head); +} /** * nfs_list_remove_request - Remove a request from its wb_list From patchwork Tue Feb 19 13:53:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10819923 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 ACF0317E9 for ; Tue, 19 Feb 2019 13:55:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B05A2990F for ; Tue, 19 Feb 2019 13:55:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F5492B17A; Tue, 19 Feb 2019 13:55:21 +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 20DDF2990F for ; Tue, 19 Feb 2019 13:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728627AbfBSNzU (ORCPT ); Tue, 19 Feb 2019 08:55:20 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:55893 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbfBSNzU (ORCPT ); Tue, 19 Feb 2019 08:55:20 -0500 Received: by mail-it1-f193.google.com with SMTP id z131so6106332itf.5 for ; Tue, 19 Feb 2019 05:55:19 -0800 (PST) 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=W/j2mn2PX0yxrHNZqs1uBfz+H/pswwQ3cFDZuA3XLOk=; b=o4ULJbGKVUHYbLOV+ph8Fwvdzgc6ikcWfUur5fYSV9iu7zgsIenAR3h/vuF/EYDSdT Smlfu8OsvR28OZxQMIWRDbqqPGJEv42KxLWoVaQDc/t8+kwza+CaYXrTRck1cQnGFCUA jtHPQ76tRCp05BQyhZwuqfSMNw8Di9bGTGOl8pNeV//8BC8xdg8vLt/DrOQ2/rZYt0UK RpMVaAvISAUcf0DyGDj4albN94cnNz5yzFV2vECh2vPqH90dCsc2Gc+L+cW3romhX/WH b2DRjJRD37WRuvGHJFu62HIL6Va0/C4VqHMWHrOdQUWeCZRrN10JRovRIQgQgshF7xDy Gn6g== 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=W/j2mn2PX0yxrHNZqs1uBfz+H/pswwQ3cFDZuA3XLOk=; b=hdmdFNkjpAkK6C0c+Vpz7vOjUamaykb7BU05PFgtRwrW69+ka3PXv2k1SdFW8uPoAr SJ5SY2XiLyB+f9BvQ0KBCyAODpFC2qESlMUnm0Yq9U3jqe5/ytmIIwtycGqbI65/0y3x aic6UX23LKDveeg+PbY6hZFfFvJh0bXfsTe2/r/dlijSNmD5TDTIEjpM/cFefR6ff+/n zhsoVxBDIDVXyxDM3L1WI+ROBHFYE7XALipofcdOIPkfRg1yShiHy+MV2y1TU7IrEz1m lNJ8PzFIjNkaN1naYR31uGCZ3zcOHwPFG1gQkUuO0OMVivGPZdSFwrjNkX1b5YMBs5bR tIXQ== X-Gm-Message-State: AHQUAuahqFwofJNzkuzrWTsV0Gk3fxwiMx5JLf1VsfYz+VG8K4ioPRi1 pZ0EH0Ren982utQLxOehy5WLFPk= X-Google-Smtp-Source: AHgI3IbCp+yekUry+QcWjoAh/bc8WBRhxpOnPBc4Si2EjFjNGXhXM0uWK/+/5xnp5za0l0DYCx4crQ== X-Received: by 2002:a02:e8a:: with SMTP id 132mr772183jae.75.1550584518522; Tue, 19 Feb 2019 05:55:18 -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 c133sm1196313itc.24.2019.02.19.05.55.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 05:55:17 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v3 5/8] NFS: Pass error information to the pgio error cleanup routine Date: Tue, 19 Feb 2019 08:53:08 -0500 Message-Id: <20190219135311.119300-6-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190219135311.119300-5-trond.myklebust@hammerspace.com> References: <20190219135311.119300-1-trond.myklebust@hammerspace.com> <20190219135311.119300-2-trond.myklebust@hammerspace.com> <20190219135311.119300-3-trond.myklebust@hammerspace.com> <20190219135311.119300-4-trond.myklebust@hammerspace.com> <20190219135311.119300-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 Allow the caller to pass error information when cleaning up a failed I/O request so that we can conditionally take action to cancel the request altogether if the error turned out to be fatal. Signed-off-by: Trond Myklebust --- fs/nfs/direct.c | 4 ++-- fs/nfs/pagelist.c | 5 +++-- fs/nfs/read.c | 2 +- fs/nfs/write.c | 11 +++++++++-- include/linux/nfs_xdr.h | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 1377ee20ecf9..0fd811ac08b5 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -428,7 +428,7 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) hdr->release(hdr); } -static void nfs_read_sync_pgio_error(struct list_head *head) +static void nfs_read_sync_pgio_error(struct list_head *head, int error) { struct nfs_page *req; @@ -820,7 +820,7 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) hdr->release(hdr); } -static void nfs_write_sync_pgio_error(struct list_head *head) +static void nfs_write_sync_pgio_error(struct list_head *head, int error) { struct nfs_page *req; diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 9cbfdb979992..695afb7de3a7 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -993,7 +993,7 @@ nfs_pageio_cleanup_request(struct nfs_pageio_descriptor *desc, LIST_HEAD(head); nfs_list_move_request(req, &head); - desc->pg_completion_ops->error_cleanup(&head); + desc->pg_completion_ops->error_cleanup(&head, desc->pg_error); } /** @@ -1129,7 +1129,8 @@ static void nfs_pageio_error_cleanup(struct nfs_pageio_descriptor *desc) for (midx = 0; midx < desc->pg_mirror_count; midx++) { mirror = &desc->pg_mirrors[midx]; - desc->pg_completion_ops->error_cleanup(&mirror->pg_list); + desc->pg_completion_ops->error_cleanup(&mirror->pg_list, + desc->pg_error); } } diff --git a/fs/nfs/read.c b/fs/nfs/read.c index f9f19784db82..1d95a60b2586 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -205,7 +205,7 @@ static void nfs_initiate_read(struct nfs_pgio_header *hdr, } static void -nfs_async_read_error(struct list_head *head) +nfs_async_read_error(struct list_head *head, int error) { struct nfs_page *req; diff --git a/fs/nfs/write.c b/fs/nfs/write.c index d09c9f878141..11df9f03245f 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1412,20 +1412,27 @@ static void nfs_redirty_request(struct nfs_page *req) nfs_release_request(req); } -static void nfs_async_write_error(struct list_head *head) +static void nfs_async_write_error(struct list_head *head, int error) { struct nfs_page *req; while (!list_empty(head)) { req = nfs_list_entry(head->next); nfs_list_remove_request(req); + if (nfs_error_is_fatal(error)) { + nfs_context_set_write_error(req->wb_context, error); + if (nfs_error_is_fatal_on_server(error)) { + nfs_write_error_remove_page(req); + continue; + } + } nfs_redirty_request(req); } } static void nfs_async_write_reschedule_io(struct nfs_pgio_header *hdr) { - nfs_async_write_error(&hdr->pages); + nfs_async_write_error(&hdr->pages, 0); filemap_fdatawrite_range(hdr->inode->i_mapping, hdr->args.offset, hdr->args.offset + hdr->args.count - 1); } diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 441a93ebcac0..b4bd2bf5f585 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1549,7 +1549,7 @@ struct nfs_commit_data { }; struct nfs_pgio_completion_ops { - void (*error_cleanup)(struct list_head *head); + void (*error_cleanup)(struct list_head *head, int); void (*init_hdr)(struct nfs_pgio_header *hdr); void (*completion)(struct nfs_pgio_header *hdr); void (*reschedule_io)(struct nfs_pgio_header *hdr); From patchwork Tue Feb 19 13:53:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10819925 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 235CA1805 for ; Tue, 19 Feb 2019 13:55:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FDFC2990F for ; Tue, 19 Feb 2019 13:55:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 043492A7CE; Tue, 19 Feb 2019 13:55:22 +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 A9B452B343 for ; Tue, 19 Feb 2019 13:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728747AbfBSNzV (ORCPT ); Tue, 19 Feb 2019 08:55:21 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:38224 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbfBSNzU (ORCPT ); Tue, 19 Feb 2019 08:55:20 -0500 Received: by mail-it1-f193.google.com with SMTP id l66so6278822itg.3 for ; Tue, 19 Feb 2019 05:55:20 -0800 (PST) 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=S9TeiVgJ4B+Hml1DYTi2onMTx8ja6DrHTQtFR1E2UE4=; b=uAiMza9PcxQjtlkfMkQ/J4c2AAK+kZYg7iFzc3qJfQZuZfzkbejlc9lFuqh8/pSvoQ Zz7y00awQ338JNy1QiSjExvspNOr58z4BuR7jx9IENsctuzSfiZs30Kxsugq9HFSHwwy VWAewZR7mRocOSL6k8VoAODBw/3S4ztjsrxR8KRpccSeziJirnf1Rt1X3HRtsyC114e2 sI+F2hDtP08JvdGHPCH2MOWH7tuGTDBdIM2qEwDUG5pZMQKMu5lX8rT6MeRwm4aM4gis Ttq2a3ITRCZPkqmE44AcB0YTSR5i6HFU41EbWAtxfksyIaEUZzOq40MU/cC7MIwgGkNN kWbw== 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=S9TeiVgJ4B+Hml1DYTi2onMTx8ja6DrHTQtFR1E2UE4=; b=X/aTrH9HMdY+MtjMwEK2lF7JvNOibl4NpSnoNr/gECM0W8m2jPPcBYkt4WlSFSngMY 00bvGwRwuuSgAWsvzLtWIZhWoF7SCCzU3yZohX7L+w3WH+Y5cPMgAY/510n0jONd2Lkk qDy/e3cI8KkKWd6hSGpuk6XsOCEpeG3H3Z6TXikrvYBIvfvtSwHAQYhjmeFL9+eKtOwr y/+yBTgq57br2bbRjfQEWijvXxQCOv/Sj5fWiara70XzwAds6uGXivyLRZ8ddeOjQ1M/ 5okH56fN4HYl7yVzWSnIBOO5lkvWPjVU18Kkt1Z75p4pUQDWsyukadJJ0j9K5iyS07lh onNA== X-Gm-Message-State: AHQUAubqxYPh0jlpBShVzPG4c0sMSFz3wA7BXua/ui8OX9oLmZKHpgxR HglVyJWj+8PTnRxHpIuwDmHRls0= X-Google-Smtp-Source: AHgI3IZ95xuJsyzjsQPqc9x0lyj4IDqJI7GoV66/3zgBjUjgN4mbP1zk2/IsxdmBc+ke4/r14VNXow== X-Received: by 2002:a6b:641a:: with SMTP id t26mr15421133iog.204.1550584519259; Tue, 19 Feb 2019 05:55:19 -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 c133sm1196313itc.24.2019.02.19.05.55.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 05:55:18 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v3 6/8] NFS: Ensure NFS writeback allocations don't recurse back into NFS. Date: Tue, 19 Feb 2019 08:53:09 -0500 Message-Id: <20190219135311.119300-7-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190219135311.119300-6-trond.myklebust@hammerspace.com> References: <20190219135311.119300-1-trond.myklebust@hammerspace.com> <20190219135311.119300-2-trond.myklebust@hammerspace.com> <20190219135311.119300-3-trond.myklebust@hammerspace.com> <20190219135311.119300-4-trond.myklebust@hammerspace.com> <20190219135311.119300-5-trond.myklebust@hammerspace.com> <20190219135311.119300-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 All the allocations that we can hit in the NFS layer and sunrpc layers themselves are already marked as GFP_NOFS, but we need to ensure that any calls to generic kernel functionality do the right thing as well. Signed-off-by: Trond Myklebust --- fs/nfs/write.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 11df9f03245f..d1bc0384ac95 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -26,6 +26,7 @@ #include #include +#include #include "delegation.h" #include "internal.h" @@ -712,11 +713,13 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) { struct inode *inode = mapping->host; struct nfs_pageio_descriptor pgio; - struct nfs_io_completion *ioc = nfs_io_completion_alloc(GFP_NOFS); + struct nfs_io_completion *ioc; + unsigned int pflags = memalloc_nofs_save(); int err; nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGES); + ioc = nfs_io_completion_alloc(GFP_NOFS); if (ioc) nfs_io_completion_init(ioc, nfs_io_completion_commit, inode); @@ -727,6 +730,8 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) nfs_pageio_complete(&pgio); nfs_io_completion_put(ioc); + memalloc_nofs_restore(pflags); + if (err < 0) goto out_err; err = pgio.pg_error; From patchwork Tue Feb 19 13:53: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: 10819927 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 A466B6CB for ; Tue, 19 Feb 2019 13:55:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9204C2990F for ; Tue, 19 Feb 2019 13:55:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86C532B17A; Tue, 19 Feb 2019 13:55:22 +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 2F9342990F for ; Tue, 19 Feb 2019 13:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725767AbfBSNzV (ORCPT ); Tue, 19 Feb 2019 08:55:21 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:52533 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbfBSNzV (ORCPT ); Tue, 19 Feb 2019 08:55:21 -0500 Received: by mail-it1-f196.google.com with SMTP id r11so6147222itc.2 for ; Tue, 19 Feb 2019 05:55:20 -0800 (PST) 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=199vv0g4gepwPx4tiQYhia1Qf5TXo3qVp1b0Y3gwFaQ=; b=fv9xBpKyYiDb9Yg7OUkG/bP5dmV+GMDiKkiX+SkC+H/3sjjOg1WCpNl+IGnINMA7Ge A4uVEa+dMHjvG6QmbqjuLESbil7STY0G2kapJDZDCzUebWLXurhwdX5PyH6BHhNIFRvx 3CZQqnClILUVePDLhY6CwkKiqZ82Irf7ZbbGosUyew8IAnbVSpTKpuDVh1u8AQEJvZ1h 9nKTBGLeCXsc5rckM2c/JpdodoCKZmi3Pi/IAqBXEBPkeoUl0d3FdcrIWCsHb2e9xOgV s7oV598M/kyaBz5VZVRhc8L/tU+dZfJJOL/asd6rIuWNIegSrYAcpORsNpScD1oZZhN4 VVjQ== 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=199vv0g4gepwPx4tiQYhia1Qf5TXo3qVp1b0Y3gwFaQ=; b=XDreLW2oHtrJXxBCifMXO/2ipV94oWTJjoVeHXWjI4cGstZVOdCkQ6VnP85lIAsCYT Ru7Tf+QJWyGmsjkKPZSCRsgTUIaYzvp+z+kLkFtJCesRy5PWRcnVLLNxHuy7RJGWWyVg GedAjl+SW5ou9I6wdNJuxCq++Nfk3BCjfpCHDkkUZzXU5PzlWrhRZxYVTjetYBaOcAFx PdGOq6im1b4lO651pKf+0JdP4f0nPrH1XahckbKTU9vCBweFcG1q6uAS7iiVjP5tRO9X M8Ex5Ttm5wm67hwKhREmr2Pl1CVXEkO3M2oJUOfnhH4HbZUC4pdmnyr/fV5IiAbLzM/x Eohg== X-Gm-Message-State: AHQUAubV+qnoYK23GOaTs0ahmx/7bQoua7C11bW6HC8Yu3dS1OMLKJWy xIVYK4KArtdHS1cTlkARuj4J2vk= X-Google-Smtp-Source: AHgI3IZ4o/sw+XFvRA1cziFOInS7yTglq97j0Ozcoc/w9/OBIfMP4RqlBHZDet4xgFUd0/VDGAzUmw== X-Received: by 2002:a02:2303:: with SMTP id u3mr15626432jau.42.1550584520028; Tue, 19 Feb 2019 05:55:20 -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 c133sm1196313itc.24.2019.02.19.05.55.19 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 05:55:19 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v3 7/8] NFS: EINTR is also a fatal error. Date: Tue, 19 Feb 2019 08:53:10 -0500 Message-Id: <20190219135311.119300-8-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190219135311.119300-7-trond.myklebust@hammerspace.com> References: <20190219135311.119300-1-trond.myklebust@hammerspace.com> <20190219135311.119300-2-trond.myklebust@hammerspace.com> <20190219135311.119300-3-trond.myklebust@hammerspace.com> <20190219135311.119300-4-trond.myklebust@hammerspace.com> <20190219135311.119300-5-trond.myklebust@hammerspace.com> <20190219135311.119300-6-trond.myklebust@hammerspace.com> <20190219135311.119300-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 Signed-off-by: Trond Myklebust --- fs/nfs/internal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index b1e577302518..1cb9670bb8b5 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -755,6 +755,7 @@ static inline bool nfs_error_is_fatal(int err) { switch (err) { case -ERESTARTSYS: + case -EINTR: case -EACCES: case -EDQUOT: case -EFBIG: From patchwork Tue Feb 19 13:53: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: 10819931 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 3110A17E9 for ; Tue, 19 Feb 2019 13:55:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F02A2990F for ; Tue, 19 Feb 2019 13:55:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1385328A0D; Tue, 19 Feb 2019 13:55:23 +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 C384F2990F for ; Tue, 19 Feb 2019 13:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728751AbfBSNzW (ORCPT ); Tue, 19 Feb 2019 08:55:22 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:36447 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbfBSNzW (ORCPT ); Tue, 19 Feb 2019 08:55:22 -0500 Received: by mail-it1-f193.google.com with SMTP id h6so6317394itl.1 for ; Tue, 19 Feb 2019 05:55:21 -0800 (PST) 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=Hho1BGvKZPnwDF52YjAEi9f0bBIjWXPu4U6fGS0pZxA=; b=fpg0bBxIofaAZUWy3Qs8MnGtgzNr2I9kZkNMpUDs5GLRZNP7plUroFP60v3cN1DHVn l4jMrmUhqzn9RLtqfgN2+E3Ra1IPFDF5k1m2vi6c+S+xLKf6yriaNJ3B80ooC/2bmVwj hku3HjqLe99Zzi/NoaMpzluZ7Se+2fl7XKYQYUNAbGje3Ys3ytg5XaUjLt8F9f2SCTv6 v86gnqYXGbrvzybvj6jLvnpnIK5xY1a/8EOlUJ+ZAeMiXz133poDUT74+Q7RK80HXFtO vDuv9avIynYC/IVEYwB6hwGYIKsiwp9bzIaXx+Qadmbc1ZZuu7m3tcEIUoUnliOcHVpB z9qA== 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=Hho1BGvKZPnwDF52YjAEi9f0bBIjWXPu4U6fGS0pZxA=; b=AiWCZkSLOiRpY4WbcbXEL3sMgfZlcuH06ZrXTMyGe7jIt2wN+P2SF+Pt5VIy8sA0O9 WN2ZVca/XH6N4TkzVoARvDjPLpGkqiJ7gn8/m/wK4zwWwTfIO+0PRM5xBfVSRYhYP1SP vU/PO5S2tb/jqr5uRPIzT3vbiAuPb1x5D7IR429PuU8smZsC81FnFwn2RqUSPBhKfhBa qx5JXU6FyRua1uCkDon6D1u/cB6WHJkvUZRFbFclodzEgR65POuSXJvt9RBYyDkS9RU1 HKs62fZe5gN791LZCoKrScv+CO1yrulvjkhAdEIT7XSYA9k1jw8Fu7zs8yzB7aI3Upub 8Taw== X-Gm-Message-State: AHQUAuYxzkHyiOD+vipLnYS8l+nhwcgWQBp2ftiAjRx6Qv0pWfyqw65w JjAE67h/b6IZpSsTBjLtVm/3Ons= X-Google-Smtp-Source: AHgI3IYYGNYrkAsX9A35qG4yYcHN8CoicJamAyudekxQZhkYlXN3Atxdn1+/siTh1EXJN/hYeFa2aQ== X-Received: by 2002:a05:660c:741:: with SMTP id a1mr2032529itl.100.1550584520939; Tue, 19 Feb 2019 05:55:20 -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 c133sm1196313itc.24.2019.02.19.05.55.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 05:55:20 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v3 8/8] NFS: ENOMEM should also be a fatal error. Date: Tue, 19 Feb 2019 08:53:11 -0500 Message-Id: <20190219135311.119300-9-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190219135311.119300-8-trond.myklebust@hammerspace.com> References: <20190219135311.119300-1-trond.myklebust@hammerspace.com> <20190219135311.119300-2-trond.myklebust@hammerspace.com> <20190219135311.119300-3-trond.myklebust@hammerspace.com> <20190219135311.119300-4-trond.myklebust@hammerspace.com> <20190219135311.119300-5-trond.myklebust@hammerspace.com> <20190219135311.119300-6-trond.myklebust@hammerspace.com> <20190219135311.119300-7-trond.myklebust@hammerspace.com> <20190219135311.119300-8-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 Signed-off-by: Trond Myklebust --- fs/nfs/internal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 1cb9670bb8b5..b26622d9686f 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -764,6 +764,7 @@ static inline bool nfs_error_is_fatal(int err) case -EROFS: case -ESTALE: case -E2BIG: + case -ENOMEM: return true; default: return false;