Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4338193pxj; Tue, 8 Jun 2021 11:52:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJws58LJ+LbjnZP8gtUFnmY+o6xQ9TjsoERk/BqTJBDq8rpCL9QadiCdf0MyISgqlu2RdJ5A X-Received: by 2002:a17:907:2bd6:: with SMTP id gv22mr24690839ejc.431.1623178364201; Tue, 08 Jun 2021 11:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623178364; cv=none; d=google.com; s=arc-20160816; b=eiGI3GawIbquI+MuUrmXuiMhGN3OB9DUROZLUwToaCZl85jKImjxwudx6idWnNtaJ0 ZIUQUNFscRDbDhvtT3o5dLYk6g2QwPlGlkzwSVnPrQktBwGCXkh60bEt3MS1JcQUy7f4 kRnQgO7c2E4XTVm5koSjSy7L5oZaBh39RNgdVNiR5EQyNaYQSHKkkUpuxE7PPb+WBzFQ cJME2wpyLdU1rYqJcfqQTWKrryvPyseocoNBqIrTn4R4Lbh0gAJEMjTrDcPRlBbnLRSi nOUyiQiUcdvc5pw0SXjafTZt9GjlX1qHBAXecdxfOglNB71IzVITIiEt48cYAIEBHTUX EyHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YQfH20WiLnjQz8Qqiap58pTQSBe7q3eIJ9Ejp+u4pPs=; b=LK6mthiIQpjnrFIbLg8Ws+1tU+RDJT3Cfdb76pS0reQkTahi5SLQ0L+cBJd3CVWASc Yopxw985ON/5i3CC6AfnvgI24Zh3fp+STEsx7nE5BkxdVyElv5dH6yX232pq++IQVqjw /GZAkIpZIt/KF+gF2ahqfWdTW5nQsnB0tdnMPZiS9UkRVVuJPqyllzKQgXEMS37xHLDy 6+LSKQZsbP+GGudCeMRp65cPr7o6UfC2m8MgB20YLs6xYJXX3k7AzKjlE12xdQ4r6WVp C8Acr3qO12okJXxQ/y7m687lDezF7+fB7wUSviCDsMOGMJuhl9ysmBFvFrhauIjFuCWw oQwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=k4S0lZBk; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si388338edv.384.2021.06.08.11.52.09; Tue, 08 Jun 2021 11:52:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=k4S0lZBk; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235966AbhFHSwH (ORCPT + 99 others); Tue, 8 Jun 2021 14:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236212AbhFHSuG (ORCPT ); Tue, 8 Jun 2021 14:50:06 -0400 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0745C06114C for ; Tue, 8 Jun 2021 11:45:30 -0700 (PDT) Received: by mail-qk1-x72d.google.com with SMTP id k4so21285662qkd.0 for ; Tue, 08 Jun 2021 11:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YQfH20WiLnjQz8Qqiap58pTQSBe7q3eIJ9Ejp+u4pPs=; b=k4S0lZBkr+qHOUYrseRP7qCwV3qsrLltHI8k4KuY/eKMcsU/kktr7ri4WBAkomb/So zmsTxPangw4eaXX65S4rfyUr/RoJ76UNlUyoW/AeW+I29M6xCH2IcGalsLUV1U3G1Yy4 AwrgLCNhKM39g3Xk4SJ2APu0Lidlfq0YLf9WLVsi6N4sD7dl3SkILKWuk7UtaWL4EIWb Imthorg0B4XAr677WjQ5joJlmpBXhjZIUtUSc08QqNJu/K7hKNscXC1k1kKSt0jNbGPX 8FXQ7jl9TBOp492YzgLC2HYOHlFQJwH9MV8lCnNFMqP8rrs2/G1vN0/AFA+4EcSSPbRu 2YRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YQfH20WiLnjQz8Qqiap58pTQSBe7q3eIJ9Ejp+u4pPs=; b=mXOcnm6YDHGamt8TekWl05ZLEQkE7DrRWOLpsxX6A+fqTFqCnzB5Y7uotAFg6tdGNV HHUDMopWMYYyRxCFKe/TwxneHyYSTNEO6WrIjMH1rkAYbyTqYZbt6GDj5b7f4Q3dyHss YldA26H1VZ675xKUHaLD3o597p+D+VGhzToFqyvEqpnVVG8AvedfXUCJj4a5VCjyks3B CbpLyE7AG9gOzQw5eLuSmBMPyyiWr2N6qTGvLJZdMN2IlvNk6mtJjCuGi0YdFuQAmX34 0XsY7D+Nrd5njDHJY9Vrrj6bqoWzsekNpEyMp/IPUEvRtT/mKv3aYYs37yD1eS3V8DVF 9SDQ== X-Gm-Message-State: AOAM5310tyEaoysI1hpIz+c6f1DxFZ2rXNdfOClSxxaQqR11C0fduL0d ko6i3d7DRJzU7a/DXljt7oQEj31+yH0= X-Received: by 2002:a37:68c7:: with SMTP id d190mr22332799qkc.485.1623177930064; Tue, 08 Jun 2021 11:45:30 -0700 (PDT) Received: from kolga-mac-1.vpn.netapp.com (nat-216-240-30-25.netapp.com. [216.240.30.25]) by smtp.gmail.com with ESMTPSA id f130sm12365620qke.37.2021.06.08.11.45.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jun 2021 11:45:29 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH 1/1] NFSv4.1+ add trunking when server trunking detected Date: Tue, 8 Jun 2021 14:45:27 -0400 Message-Id: <20210608184527.87018-1-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Olga Kornievskaia After trunking is discovered in nfs4_discover_server_trunking(), add the transport to the old client structure before destroying the new client structure (along with its transport). Signed-off-by: Olga Kornievskaia --- fs/nfs/nfs4client.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 42719384e25f..984c851844d8 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -361,6 +361,44 @@ static int nfs4_init_client_minor_version(struct nfs_client *clp) return nfs4_init_callback(clp); } +static void nfs4_add_trunk(struct nfs_client *clp, struct nfs_client *old) +{ + struct sockaddr_storage clp_addr, old_addr; + struct sockaddr *clp_sap = (struct sockaddr *)&clp_addr; + struct sockaddr *old_sap = (struct sockaddr *)&old_addr; + size_t clp_salen, old_salen; + struct xprt_create xprt_args = { + .ident = old->cl_proto, + .net = old->cl_net, + .servername = old->cl_hostname, + }; + struct nfs4_add_xprt_data xprtdata = { + .clp = old, + }; + struct rpc_add_xprt_test rpcdata = { + .add_xprt_test = old->cl_mvops->session_trunk, + .data = &xprtdata, + }; + + if (clp->cl_proto != old->cl_proto) + return; + clp_salen = rpc_peeraddr(clp->cl_rpcclient, clp_sap, sizeof(clp_addr)); + old_salen = rpc_peeraddr(old->cl_rpcclient, old_sap, sizeof(old_addr)); + + if (clp_addr.ss_family != old_addr.ss_family) + return; + + xprt_args.dstaddr = clp_sap; + xprt_args.addrlen = clp_salen; + + xprtdata.cred = nfs4_get_clid_cred(old); + rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args, + rpc_clnt_setup_test_and_add_xprt, &rpcdata); + + if (xprtdata.cred) + put_cred(xprtdata.cred); +} + /** * nfs4_init_client - Initialise an NFS4 client record * @@ -434,6 +472,8 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp, * won't try to use it. */ nfs_mark_client_ready(clp, -EPERM); + if (old->cl_mvops->session_trunk) + nfs4_add_trunk(clp, old); } clear_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags); nfs_put_client(clp); -- 2.27.0