Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1428676rwp; Thu, 13 Jul 2023 10:39:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlEmRidyzshRNPb6h8koiCtGiR2Of5fHez6ly0sZXREx7m1XDwIpzKHm4jtansMi7F/ZCkTe X-Received: by 2002:a92:d385:0:b0:346:7a41:6c62 with SMTP id o5-20020a92d385000000b003467a416c62mr2102419ilo.15.1689269989922; Thu, 13 Jul 2023 10:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689269989; cv=none; d=google.com; s=arc-20160816; b=kXQgMzCu/HtWVVqSiZCzXR3o5ct8GcEtJNgjI22nEm0fkrAHh2LyRTchNBUGVsgtWk jUwfzS6M9Rygvskk2vUrt27r96dZjkty1QlbmwGolmzGRbX4Goly/LD+gAUCWLdFhhrT kvigCMLN93fNvnW254cwyiT1VTWdbHNK+FHwRyvBJDiX191noDzTaGQeCSoKF4eGyGzw Q1xEx9w+tbustYEKi99W0ZwvYKBoTCCG0PrMzkTvo2MJjuNJOahgShWaQXfPlLJlvI0L X9LH/RgBoUa5EA9Qddz0q+eA6nvScq5KNkmf5DpWhd0WwX2dntL+t1AXcJsBiRZAXyLk K1dQ== 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=/jGLZbFflKh8iVJ5pfkLpxhZEV6cFYv+46Kvu9MMZAU=; fh=Nr9rl7v5eDYTDyscIppdBBppfgMblN3c2vT7sHu54Co=; b=dMd8WPu3qAYyBG5LiH8G7Qu29w8cs5/h7lO0giz4jkyyxLCXB+sNdn5zmxyB6BHU+v Qs2wzhG38f1J/PjXranrYsLtjeIvG06w3zoGpM4IW73LqBousRPGP/Gi4j8C8yVimsW0 ta66dEyCioAQYAOPj0N60hWu8EmIoVpBU24UM7OTfJ3Je0fkP1lPESsd86nZUk7ngNZd U0hZwkXPulOTFvGC5av9xKMJfMJEiO0axIICbz58FdvsAgn1bQTJblzaCKuScUwkaubL unFK8FYrfwGZEB+BeWRjBWYXrF6IBIe58Rnn7CBNVzFGKw7BAmnR+e0/h0PS/SHaO+Z5 z1Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=VC5Xx7zQ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j190-20020a6380c7000000b005347d6bd7eesi5432649pgd.141.2023.07.13.10.39.30; Thu, 13 Jul 2023 10:39:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=VC5Xx7zQ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231303AbjGMRfP (ORCPT + 99 others); Thu, 13 Jul 2023 13:35:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230051AbjGMRfP (ORCPT ); Thu, 13 Jul 2023 13:35:15 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 431A12699 for ; Thu, 13 Jul 2023 10:35:14 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-346317895e7so456535ab.1 for ; Thu, 13 Jul 2023 10:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689269713; x=1689874513; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/jGLZbFflKh8iVJ5pfkLpxhZEV6cFYv+46Kvu9MMZAU=; b=VC5Xx7zQ7S/Z4aOuGj53my6J4oSh4gU+bKTQ3FZBQ0Ki4FMkjahp7ofQfvXCDaMyMy Wbkm1Uc57FI3IduSCIw+S1E2h5WuGlFO0HwC5NmOb2WuygI/3nnKw+AQHI28oPIxCMsD WpPddcpPq+tK82EHUL7uZNRymlWvY6Ke8nDbwfwWsd2VlmWHHKzbvEDBolANwoJj9IHY mbHaztKyxBRU3za3gDSSDHTzb1obt41UQogyAJNTN8n5WYQXULHKitWoT9+XRYaSzGDs dhe7gjSuwhFukpsRqx+BBTCOr5NLbRzC5JJFvT7BEbziqEZve6OGF6iNaTEkcNBmMXHV 3MdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689269713; x=1689874513; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/jGLZbFflKh8iVJ5pfkLpxhZEV6cFYv+46Kvu9MMZAU=; b=QdwmXl+y12TBOjvVIkiZEWLseov0alp427sYDlkGlDeb4jRKEc+vzjj5s3mUER3byG ZzymlPavdDYUMfNRW0O4Ob1LpcrFzcM6G9mndLY9WN+tRp9VHAaveFujE3yeC0QUf9Fi IzXfXafgYe0M8H9ppDTNRIFnac/LT9FkVogcmkIVJ4YGYNQuic3u2c0whKZXebEbwiBQ 89wGVqUgTZ0wNAfMVDlcmTUAtpexD9qS4V5Fbw3bElKpMMxC4ieADaJIwTW0td4xjPFV pD1ZHKOcq5iz5BmPQQlFmlj9IoTE9ELoOQ5fhuPHFRtkH59p0kOfqxb8i+CfBy/kF5sQ kgtg== X-Gm-Message-State: ABy/qLabWaIgotP5rtZUXuznOqKt21a06kI36UM6tfEwMuMS8C2hjJTL QimwYGOYAjNjtyCq6Na3Q8lQSO85TW4= X-Received: by 2002:a05:6e02:924:b0:33b:d741:5888 with SMTP id o4-20020a056e02092400b0033bd7415888mr1538341ilt.0.1689269713497; Thu, 13 Jul 2023 10:35:13 -0700 (PDT) Received: from kolga-mac-1.attlocal.net ([2600:1700:6a10:2e90:e116:c73f:66fd:3d1b]) by smtp.gmail.com with ESMTPSA id b3-20020a92db03000000b00345e3a04f2dsm2171705iln.62.2023.07.13.10.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 10:35:12 -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: fix pnfs MDS=DS session trunking Date: Thu, 13 Jul 2023 13:35:11 -0400 Message-Id: <20230713173511.24651-1-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Olga Kornievskaia Currently, when GETDEVICEINFO returns multiple locations where each is a different IP but the server's identity is same as MDS, then nfs4_set_ds_client() finds the existing nfs_client structure which has the MDS's max_connect value (and if it's 1), then the 1st IP on the DS's list will get dropped due to MDS trunking rules. Other IPs would be added as they fall under the pnfs trunking rules. Instead, this patch prposed to treat MDS=DS as DS trunking and make sure that MDS's max_connect limit does not apply to the 1st IP returned in the GETDEVICEINFO list. Signed-off-by: Olga Kornievskaia --- fs/nfs/nfs4client.c | 7 ++++++- net/sunrpc/clnt.c | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 27fb25567ce7..b35acd79b895 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -417,6 +417,7 @@ static void nfs4_add_trunk(struct nfs_client *clp, struct nfs_client *old) .net = old->cl_net, .servername = old->cl_hostname, }; + int max_connect = old->cl_max_connect; if (clp->cl_proto != old->cl_proto) return; @@ -428,9 +429,12 @@ static void nfs4_add_trunk(struct nfs_client *clp, struct nfs_client *old) xprt_args.dstaddr = clp_sap; xprt_args.addrlen = clp_salen; + if (clp->cl_max_connect != old->cl_max_connect && + test_bit(NFS_CS_DS, &clp->cl_flags)) + max_connect = clp->cl_max_connect; rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args, - rpc_clnt_test_and_add_xprt, NULL); + rpc_clnt_test_and_add_xprt, &max_connect); } /** @@ -1010,6 +1014,7 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_server *mds_srv, __set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); __set_bit(NFS_CS_DS, &cl_init.init_flags); + cl_init.max_connect = NFS_MAX_TRANSPORTS; /* * Set an authflavor equual to the MDS value. Use the MDS nfs_client * cl_ipaddr so as to use the same EXCHANGE_ID co_ownerid as the MDS diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index d7c697af3762..dfdb4bc96367 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2908,12 +2908,15 @@ static const struct rpc_call_ops rpc_cb_add_xprt_call_ops = { */ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt, struct rpc_xprt_switch *xps, struct rpc_xprt *xprt, - void *dummy) + void *in_max_connect) { struct rpc_cb_add_xprt_calldata *data; struct rpc_task *task; + int max_connect = clnt->cl_max_connect; - if (xps->xps_nunique_destaddr_xprts + 1 > clnt->cl_max_connect) { + if (in_max_connect) + max_connect = *(int *)in_max_connect; + if (xps->xps_nunique_destaddr_xprts + 1 > max_connect) { rcu_read_lock(); pr_warn("SUNRPC: reached max allowed number (%d) did not add " "transport to server: %s\n", clnt->cl_max_connect, -- 2.39.1