From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34E0AC43381 for ; Thu, 21 Mar 2019 10:19:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F058B218AE for ; Thu, 21 Mar 2019 10:19:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553163584; bh=PR8it9i4lehW/wvAmhBtSruQ8MSFuRpMrLNLXMrKrus=; h=Subject:To:Cc:From:Date:List-ID:From; b=FRNEey056JbjHen/ksnbERNL01k+ER97FPdXWQngb3SqgmnSkaSt138KBzYPZK+Bt uuiAu+/BI93ml/VF9GOHl16PvB4PmMuFZzpPrJJFokd+jySUaJ7ljbi/QYojLS7rqr cl10sXJitKzhZo9vzNwI0VzR1NvNiJw6nOzKWQ58= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727859AbfCUKTn (ORCPT ); Thu, 21 Mar 2019 06:19:43 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:59683 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727857AbfCUKTn (ORCPT ); Thu, 21 Mar 2019 06:19:43 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3B25D23451; Thu, 21 Mar 2019 06:19:42 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 21 Mar 2019 06:19:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Y8oYQC ZaH1hs8PktFxXT9ekFwgvkiPlcPBKhhZEnyPc=; b=oA/a+KVSkrHmd0ig/Wt9va lmDjXW0R+oFLLgdIlWM/l6jRtQ9xfT/zo5NBctIT1X3Th2KiRi8ruk0OEcGW7pcN /Kds3EUMKwn96cVreeOch7PEkPpnruL95/hO+I+r8MIx1jBObGd3IXBrZ0DG8cL3 ouFYzc/j1Gf9FHS3Wh35MxHuQqCbCT9Wmi9GMlMAKJeJjeCN7yjmkhhO32Qo/CjR 0zqPQf3FeNoaRiHav//xty6hIHjHmjH812+AOIGldHdEpYhAjVbNH87FjMM0j0NC IHnyxHtqPCf6VTe2fYVgyEK1I7nNI5o+aBfUd5C6zZhMrWax+DBFWy2pzwOH4jMg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrieelucetufdoteggodetrfdotffvucfrrh hofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttddtlfenuc fhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhrgheqnecu kfhppeelhedrleekrddvjedrudekjeenucfrrghrrghmpehmrghilhhfrhhomhepghhrvg hgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (unknown [95.98.27.187]) by mail.messagingengine.com (Postfix) with ESMTPA id 543F91031C; Thu, 21 Mar 2019 06:19:41 -0400 (EDT) Subject: FAILED: patch "[PATCH] nfs: clean up rest of reqs when failing to add one" failed to apply to 4.4-stable tree To: tao.peng@primarydata.com, trond.myklebust@primarydata.com Cc: From: Date: Thu, 21 Mar 2019 11:19:39 +0100 Message-ID: <1553163579170199@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From c18b96a1b8629db8cf5ac9f8974ccb4abcc209ab Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Sat, 5 Dec 2015 01:59:56 +0800 Subject: [PATCH] nfs: clean up rest of reqs when failing to add one If we fail to set up things before sending anything over wire, we need to clean up the reqs that are still attached to the IO descriptor. Signed-off-by: Peng Tao Signed-off-by: Trond Myklebust diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 728f65884cea..13faa303eb3b 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1126,6 +1126,7 @@ static int nfs_do_recoalesce(struct nfs_pageio_descriptor *desc) static int nfs_pageio_add_request_mirror(struct nfs_pageio_descriptor *desc, struct nfs_page *req) { + struct nfs_pgio_mirror *mirror = nfs_pgio_current_mirror(desc); int ret; do { @@ -1153,7 +1154,7 @@ int nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, nfs_pageio_setup_mirroring(desc, req); if (desc->pg_error < 0) - return 0; + goto out_failed; for (midx = 0; midx < desc->pg_mirror_count; midx++) { if (midx) { @@ -1170,7 +1171,8 @@ int nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, if (IS_ERR(dupreq)) { nfs_page_group_unlock(req); - return 0; + desc->pg_error = PTR_ERR(dupreq); + goto out_failed; } nfs_lock_request(dupreq); @@ -1183,10 +1185,19 @@ 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)) - return 0; + goto out_failed; } 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) + desc->pg_completion_ops->error_cleanup(&mirror->pg_list); + return 0; } /*