Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3474079imu; Sun, 11 Nov 2018 15:56:28 -0800 (PST) X-Google-Smtp-Source: AJdET5eocSnucM+8piVGcD2RLSMI5J5tkPVjLKC6mZIfvCWn5u+qBM2rtAmVWvVC6RqIIx4tIUBg X-Received: by 2002:a63:2586:: with SMTP id l128mr15794170pgl.104.1541980588720; Sun, 11 Nov 2018 15:56:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980588; cv=none; d=google.com; s=arc-20160816; b=acXxvsEglLBP1vPQkjkalmNBeWjaei0TTJT9TVVn/gIG4+eP5ZAGjzE6/0+hrk4tQa lNEqqWn5HGOYFd7IwDYoNCOIfeUycwpHxmzpPgNZxKoM4Z25xJPTuuUJ56pntScF1PPQ qoKd4vH75e5zohjkidvN/CXXIWj5H31mFohLSHwkEvmTU6JMH20zK0CT/L8mdhi/wlSc lPqP/0SwnVprNG6yVVXBSCChPgwt2TeqVAl5vlsAcJHGQUpmW8oGzActs5zQBnv2FHOT ppv+88xAo0U2uQRJSejxB9KBWq+uRQbCXe/k1KMnzBEp2pPjUcuapvxAcJcNzC3gSbwe Aheg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5fLyxHSHLSbKe0aqZj6xXXDtbweGi6OaGvfUmtaR2LQ=; b=tuXNA0SffTxVBzQGC7nHDFlE9CW8UAtM24x/junnVSw67yU9CuGJ5Z8Sg2wYhw0Wpe /YIFXtdBXPYgL9WZzpCu660Qd/33Ij+Po/eZ6+lRPURzmJaKZEx6wnlw99sQxhkQ8t0F joAxd3dtWd97FghkbP8mPcejndtjlkoB8mn889DQBt+dIziTTxQFHEtul4aEQSx6Fnti i0k3IoKSBoxR5lI4q3q8cNvhhPNy9aHZVtqMqvMIlvPu99syGtjQNaGip0YwwhX5zSrW GVl9qzELaNrrj9Cc5rlzC0tjqIDitc1ALSp28+9ae64m1NRuBW+hD4KVrdpvlzif2Bkp nFrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WtheV6jy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17-v6si14756485pgf.443.2018.11.11.15.56.13; Sun, 11 Nov 2018 15:56:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WtheV6jy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732713AbeKLISV (ORCPT + 99 others); Mon, 12 Nov 2018 03:18:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:37302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732701AbeKLISU (ORCPT ); Mon, 12 Nov 2018 03:18:20 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC15621527; Sun, 11 Nov 2018 22:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975304; bh=eWVwcroubJxb7p98oDmQDuYL7BuhIcsH8EFG8k6XvgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WtheV6jyLIDJXwz2o18660/KtCNrCGt5AnB5IzrXRRV7vKUd11aUx4fQOEihVLuxx DATbaxdskkHp5I+QO7QMteOOR9en+c42Mw95YVs4RLWLuMB+lZyh/NOnOHXZAxw0Yc LVA7Rsh3+vXIJ23RPzwylvPZUIqqtxcZZW6C4EXo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Coddington , Trond Myklebust Subject: [PATCH 4.19 271/361] nfs: Fix a missed page unlock after pg_doio() Date: Sun, 11 Nov 2018 14:20:18 -0800 Message-Id: <20181111221655.049764018@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Benjamin Coddington commit fdbd1a2e4a71adcb1ae219fcfd964930d77a7f84 upstream. We must check pg_error and call error_cleanup after any call to pg_doio. Currently, we are skipping the unlock of a page if we encounter an error in nfs_pageio_complete() before handing off the work to the RPC layer. Signed-off-by: Benjamin Coddington Cc: stable@vger.kernel.org Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/pagelist.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1111,6 +1111,20 @@ static int nfs_pageio_add_request_mirror return ret; } +static void nfs_pageio_error_cleanup(struct nfs_pageio_descriptor *desc) +{ + u32 midx; + struct nfs_pgio_mirror *mirror; + + if (!desc->pg_error) + return; + + for (midx = 0; midx < desc->pg_mirror_count; midx++) { + mirror = &desc->pg_mirrors[midx]; + desc->pg_completion_ops->error_cleanup(&mirror->pg_list); + } +} + int nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, struct nfs_page *req) { @@ -1161,25 +1175,11 @@ int nfs_pageio_add_request(struct nfs_pa return 1; out_failed: - /* - * We might have failed before sending any reqs over wire. - * Clean up rest of the reqs in mirror pg_list. - */ - if (desc->pg_error) { - struct nfs_pgio_mirror *mirror; - void (*func)(struct list_head *); - - /* remember fatal errors */ - if (nfs_error_is_fatal(desc->pg_error)) - nfs_context_set_write_error(req->wb_context, - desc->pg_error); - - func = desc->pg_completion_ops->error_cleanup; - for (midx = 0; midx < desc->pg_mirror_count; midx++) { - mirror = &desc->pg_mirrors[midx]; - func(&mirror->pg_list); - } - } + /* remember fatal errors */ + if (nfs_error_is_fatal(desc->pg_error)) + nfs_context_set_write_error(req->wb_context, + desc->pg_error); + nfs_pageio_error_cleanup(desc); return 0; } @@ -1251,6 +1251,8 @@ void nfs_pageio_complete(struct nfs_page for (midx = 0; midx < desc->pg_mirror_count; midx++) nfs_pageio_complete_mirror(desc, midx); + if (desc->pg_error < 0) + nfs_pageio_error_cleanup(desc); if (desc->pg_ops->pg_cleanup) desc->pg_ops->pg_cleanup(desc); nfs_pageio_cleanup_mirroring(desc);