From patchwork Tue Dec 11 09:58:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh kumar pradhan X-Patchwork-Id: 10723367 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 1AD0C18A7 for ; Tue, 11 Dec 2018 09:59:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A92229C47 for ; Tue, 11 Dec 2018 09:59:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F28A82A23C; Tue, 11 Dec 2018 09:58:59 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 1DB5A2A228 for ; Tue, 11 Dec 2018 09:58:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726164AbeLKJ65 (ORCPT ); Tue, 11 Dec 2018 04:58:57 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:6489 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726117AbeLKJ65 (ORCPT ); Tue, 11 Dec 2018 04:58:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1544522337; x=1576058337; h=from:to:cc:subject:date:message-id; bh=OQrurx9pZYUdQMtZ2mb4ZcfbSAYqKn/5RMLKdrgpsCs=; b=VEd0Ugw5AvPNT7+xMoxPW1SPruzLOSBJsEzrGN7ZeNt1Qv3w74JVgYT8 IcpBfx27peZg2SCs83rgQ+qR3UlRvv/zfiB6Z1u86Q4lj2aVcYhiw+3e2 37zVYrQCOZPrJe5TJ3lSb1LYdS/xWki+hH4O4sFAiU7dkTHmB5x4N6Xah RSaOAdAuWSwhgJIFDh1JGsbak3onfHT2ugiLCupBg3AhKy5eQJkbB4pqC c5EYSjeABTiaVA9L4doBe/4ZVYxzkISjWnNidyEd7Y80TiVyBCew0/luC uVtDUPqugL0wEtsA+PWNuMQ1eIdN7am2biqE+RlsnSODk5/VmAIKan3Lb g==; X-IronPort-AV: E=Sophos;i="5.56,342,1539619200"; d="scan'208";a="101206922" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 11 Dec 2018 17:58:56 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 11 Dec 2018 01:41:31 -0800 Received: from unknown (HELO C02VRAUAHV29.wdc.com) ([10.113.196.133]) by uls-op-cesaip01.wdc.com with ESMTP; 11 Dec 2018 01:58:55 -0800 From: Santosh kumar pradhan To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org, Santosh Kumar Pradhan Subject: [PATCH] sunrpc: Add xprt after nfs4_test_session_trunk() Date: Tue, 11 Dec 2018 15:28:43 +0530 Message-Id: <20181211095843.5338-1-santoshkumar.pradhan@wdc.com> X-Mailer: git-send-email 2.18.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 From: Santosh Kumar Pradhan Multipathing: In case of NFSv3, rpc_clnt_test_and_add_xprt() adds the xprt to xprt switch (i.e. xps) if rpc_call_null_helper() returns success. But in case of NFSv4.1, it needs to do EXCHANGEID to verify the path along with check for session trunking. Add the xprt once nfs4_test_session_trunk() returns success. Also release refcount hold by rpc_clnt_setup_test_and_add_xprt(). Signed-off-by: Santosh Kumar Pradhan Tested-by: Suresh Jayaraman --- net/sunrpc/clnt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index d839c33ae7d9..053f594cc144 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2654,10 +2654,14 @@ int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *clnt, goto out_err; /* rpc_xprt_switch and rpc_xprt are deferrenced by add_xprt_test() */ - xtest->add_xprt_test(clnt, xprt, xtest->data); + status = xtest->add_xprt_test(clnt, xprt, xtest->data); + if (status != 0) + goto out_err; - /* so that rpc_clnt_add_xprt does not call rpc_xprt_switch_add_xprt */ - return 1; + xprt_put(xprt); + xprt_switch_put(xps); + /* so that rpc_clnt_add_xprt calls rpc_xprt_switch_add_xprt */ + return 0; out_err: xprt_put(xprt); xprt_switch_put(xps);