Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3415943imu; Sun, 11 Nov 2018 14:33:34 -0800 (PST) X-Google-Smtp-Source: AJdET5e7oGAge60ZOaivzy9mPEzEa+idGS7OlSAQ3MZKs8BbJUlUHx6OO8yKD2OBezt2AwwRdKQo X-Received: by 2002:a63:f241:: with SMTP id d1mr15455373pgk.2.1541975614033; Sun, 11 Nov 2018 14:33:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541975614; cv=none; d=google.com; s=arc-20160816; b=gmt6vFsXM9DQhe7x7y8oYewrnJ6SQGogccwZwBWQ80kBupE1WhLzvyHp67kj/ciBL5 E0oQEnuH7vzZaqd88/kR4Vjc8hcmV8BQR2+tGQbIbfvpEwhvxJIo5IhxGb42flfmEli6 Xl/6ZLO3NlouFDx7p6rU974H4YDneyluP9rlu0lAl8aTc426SExveZERNyHl3xtD4+pk CfH8AXQwjWiQ7soZuqb7MCJ5Bt1zjZBETbeB16SAUm/6hCxMvvvfE6jLqy81CzmHvtlw i9hWLeMfbUQ/tNyoNFrA8imf7LNp9ULl6AAmqBHEuHHRFWQgxiEe9GzXwg9H05ToPvbn 90uQ== 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=mhuzT5PUztiTnS+uHRysxY1/4BCd0JV+cyWuy2pdetc=; b=Fcn89RRTKWFjpNwHWGFPHaxsroFNOyL7o1VQ+fTiFHLgl7/C0lGGMO51Ze4j0oUPn8 sBID4AQ9/odJcKc96Qbw/Mbo8kbVWHt+DNJg344yyRIU02+flHQikas345QxIj1MTquh mcQdvGfrdWYcGXzH3FjqTXWb6InqBRXiqvlF93vXH21YkD+TbBGRVYTNpURfrgZgyoil LDl35N6Ipf0VCIbo7ZcFwSUlwwUDTXQdtJgnSWTZfBVMjxxrM0PXVbRvke2c2Lcevkut KRoXMz3QEBcp9FmTjdLN3R+MJgl+6y+N9PHiM2kSwJLSGTC+b6GOXCsNe1LcDRXTM0Ds XQ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OUGPXI4n; 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 x5si14887834pgq.535.2018.11.11.14.33.18; Sun, 11 Nov 2018 14:33:33 -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=OUGPXI4n; 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 S2404010AbeKLIW6 (ORCPT + 99 others); Mon, 12 Nov 2018 03:22:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:54620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403989AbeKLIW5 (ORCPT ); Mon, 12 Nov 2018 03:22:57 -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 8085C223CB; Sun, 11 Nov 2018 22:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975580; bh=t85+HlUql18Uf9kVo9t7xmiKkBdo7wkP7OwgfsMTlDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OUGPXI4n9Y4C2GH7v3LzEWmezkwNK9yEbk7SX1YEorGpBeuBbqAStrihi2nwI9CjH Ri0Syf9EfzYn6/7+mb3N99Zv4GN0DKP01SBqgCEo1d1BAm3x0DUvr6fa1aaSTrgvHI NOtPi9KjSFo0lW5U5LCRa3yyDwgt09d2KKfPlopw= 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.14 170/222] nfs: Fix a missed page unlock after pg_doio() Date: Sun, 11 Nov 2018 14:24:27 -0800 Message-Id: <20181111221702.412408857@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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.14-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 @@ -1110,6 +1110,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) { @@ -1160,25 +1174,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; } @@ -1250,6 +1250,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);