Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1024043ybe; Wed, 4 Sep 2019 11:18:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+p+3qQ+KBgNIumd5B3oHDnxGcJJqGAvJJlfptI0cCS9ffZZfgezRaCE6SYKy5AslGGTPj X-Received: by 2002:a63:506:: with SMTP id 6mr35996396pgf.434.1567621106874; Wed, 04 Sep 2019 11:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621106; cv=none; d=google.com; s=arc-20160816; b=0AaQH+j2hWjAZw9C4tnfCqgMsGYpxIZQSg/0BX+HuKttqRwqPgmaZGxQaaRhcEeo5q paG4D6PBenFFRr48rO4kB4tFl2GTmj053Jim8m5GSYhqDU4ITR59TP1a/8KPhSHjxnnd c2Kw8KOTzTpPybYBJnrIS/gPczF+kWWniigl6l/KtGm3pxr+cuyyKK/kunkzyBD3pf2v alI8CNNFA+tciwsEtaore5g4x5kL7YclBvr46FZS/WeTRTMdZnkPOWEE+SxA4I2M3smN tED3Df/1cbqyTP8S60ooBxJVGm8qwPYmgZRfR1/qZptoCkUg3+RSz8TfUX0fr5JAYPfH fuzw== 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=40z/dVyD1EfirZkLjM5/tnnX4xnpN17QeHqVOuyI5MA=; b=lylvedqeILaZ+xhb7PYezGKU6e+PBDVKlUbhdTwcUYvlzbPjvsgYGEfbBNPt63IKeg B64EY01Gvc0Y9CU/7SClhdsvxqgiUcalJ0Gp3f8l2tzdlpCBg1G2dB3/aULv7TOnaRnP aCxrf6bXk6ZKSpiSQoeux+1S1H5L9nw3ggjxB2KDpxLVhXMWhHijZPFddZwIKAERNOUA 1oYZlC1ryudawaZWmFmcincn53IN8TwEQA9B9Rxn7aofqNyPWskTgUnUGpEGf8xvscn3 IohAwn+GpGxbi8GQVHLbhAktD0QmhUn9pTAOTfFna/0UCUj/BbMNvEJbzlMCP5xHLtmw roVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=db6KvBD1; 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 x130si17774740pgx.526.2019.09.04.11.18.11; Wed, 04 Sep 2019 11:18:26 -0700 (PDT) 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=db6KvBD1; 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 S2390470AbfIDSOP (ORCPT + 99 others); Wed, 4 Sep 2019 14:14:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:59316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390742AbfIDSOM (ORCPT ); Wed, 4 Sep 2019 14:14:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7578E206BA; Wed, 4 Sep 2019 18:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620852; bh=auObbfFtxe1vAJIVlAJXLA+5R7odgXX5KYToodQnPi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=db6KvBD1B+wZJ9MaNQxZdv1QonuTlUsp4S4ZryxHJCjyQ6gPshZUMRnuhTY+HCrK1 mAb0VwOMoqc0fMtN903t0+RCUS0693+l8/KkjGAskMQoHD4iSjXPhs5NP4J8a8PFvq P1O0p0x3Uk5sTJX+AwXMa3PpZHsqmWcciEkuuMO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.2 119/143] SUNRPC: Dont handle errors if the bind/connect succeeded Date: Wed, 4 Sep 2019 19:54:22 +0200 Message-Id: <20190904175319.054317713@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Trond Myklebust commit bd736ed3e2d1088d9b4050f727342e1e619c3841 upstream. 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+ Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/clnt.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -1893,6 +1893,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)) { @@ -1900,14 +1901,15 @@ call_bind_status(struct rpc_task *task) return; } - if (task->tk_status >= 0) { - dprint_status(task); + dprint_status(task); + trace_rpc_bind_status(task); + if (task->tk_status >= 0) + goto out_next; + if (xprt_bound(xprt)) { task->tk_status = 0; - task->tk_action = call_connect; - return; + goto out_next; } - trace_rpc_bind_status(task); switch (task->tk_status) { case -ENOMEM: dprintk("RPC: %5u rpcbind out of memory\n", task->tk_pid); @@ -1966,7 +1968,9 @@ call_bind_status(struct rpc_task *task) rpc_call_rpcerror(task, status); return; - +out_next: + task->tk_action = call_connect; + return; retry_timeout: task->tk_status = 0; task->tk_action = call_bind; @@ -2013,6 +2017,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; @@ -2022,8 +2027,17 @@ call_connect_status(struct rpc_task *tas } dprint_status(task); - trace_rpc_connect_status(task); + + if (task->tk_status == 0) { + clnt->cl_stats->netreconn++; + goto out_next; + } + if (xprt_connected(xprt)) { + task->tk_status = 0; + goto out_next; + } + task->tk_status = 0; switch (status) { case -ECONNREFUSED: @@ -2054,13 +2068,12 @@ call_connect_status(struct rpc_task *tas 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;