From patchwork Wed Jun 16 01:10:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12323597 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 037F4C48BE8 for ; Wed, 16 Jun 2021 01:10:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE66661246 for ; Wed, 16 Jun 2021 01:10:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231703AbhFPBMZ (ORCPT ); Tue, 15 Jun 2021 21:12:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229979AbhFPBMY (ORCPT ); Tue, 15 Jun 2021 21:12:24 -0400 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D01DC06175F for ; Tue, 15 Jun 2021 18:10:18 -0700 (PDT) Received: by mail-qk1-x72c.google.com with SMTP id d196so900568qkg.12 for ; Tue, 15 Jun 2021 18:10:18 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=7SfaMZZ0vlI2y02Jl2xfftekKLJe3H9jraX9ERFYGAI=; b=pnmuJJDTjZKmT1iM/Sfw/piCjDqR4AEUk7qUZSCI9wq3/WrWpE3mM7pEB+zmtqaGUi RRFKi2F+Lno54mt/kgYBQey5BVVghKFuw8cr6SO4L69ItXDLHulCbK+3TC1vqVWg8YSI KYyMcM4sHuI1MLygQ3lNVcoXkhLsjdwWURKtplSejglklvKBdoWkGslgdYJsPWWF9Zyk ezGhAJTUQ+R1SAGGdH+qp655lOSxysGwnAYYv3GiUlD7J3MxYimPS8DXzyQZlDT+ImIX WiL6uHEfY0G6zX3fJIwqnDPjcgMv/Ro1nr4ePgo1+ifJHtJUIieE9WEaH03BE/w765Cc YSOA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=7SfaMZZ0vlI2y02Jl2xfftekKLJe3H9jraX9ERFYGAI=; b=GVpH0s/wrxnERL7egYMhY54+srrFl2bjCvKxu0f1Q6OvHsOTBBTX6y96ZMpY6lzplb Yv0zT1KJVu/22X+k5vEvdjjGVMfzpSxmATYFW1l6t/smkTQ16VL4QN40fzEJ21a0i//p PEJxO25oYC7T96/TR2CdIdv6ooH3V97XemSBonopMYhQJjM3JJglFvizeLeeg1xtPTpL os40V490kKUl2YeibT2d0SrQiUVX+r0i8fWDo7BftwkminImlgu3q2XagI95wYOwXUKl a2W8r06oEBlwlHr0rCYG7dkG2xLPTjS0gHQXlfqtwfz9WGmmoieZxrTU+EXAjVDGi24A 6dow== X-Gm-Message-State: AOAM533VsCGbHf/K217QnBiYfXmp+n3VU1w+QNXnRSE9FGKBC9bwgJYZ l+Q8lAOD902clazwOLf7IZqrSGyc2urSbQ== X-Google-Smtp-Source: ABdhPJyt2GqshBcIok8/b0K5IeOFphvBXRQpVcNppGeBiWLtWOAM+vYiUx0EBF8VTJVD25r5LtwdeA== X-Received: by 2002:a05:620a:1299:: with SMTP id w25mr2664359qki.320.1623805817704; Tue, 15 Jun 2021 18:10:17 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id m189sm546007qkd.107.2021.06.15.18.10.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jun 2021 18:10:17 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 1/6] SUNRPC keep track of number of transports to unique addresses Date: Tue, 15 Jun 2021 21:10:08 -0400 Message-Id: <20210616011013.50547-2-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210616011013.50547-1-olga.kornievskaia@gmail.com> References: <20210616011013.50547-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Olga Kornievskaia Currently, xprt_switch keeps a number of all xprts (xps_nxprts) that were added to the switch regardless of whethere it's an nconnect transport or a transport to a trunkable address. Introduce a new counter to keep track of transports to unique destination addresses per xprt_switch. Signed-off-by: Olga Kornievskaia --- include/linux/sunrpc/xprtmultipath.h | 1 + net/sunrpc/clnt.c | 2 +- net/sunrpc/xprtmultipath.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/sunrpc/xprtmultipath.h b/include/linux/sunrpc/xprtmultipath.h index b19addc8b715..bbb8a5fa0816 100644 --- a/include/linux/sunrpc/xprtmultipath.h +++ b/include/linux/sunrpc/xprtmultipath.h @@ -18,6 +18,7 @@ struct rpc_xprt_switch { unsigned int xps_id; unsigned int xps_nxprts; unsigned int xps_nactive; + unsigned int xps_nunique_destaddr_xprts; atomic_long_t xps_queuelen; struct list_head xps_xprt_list; diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 9bf820bad84c..e6801a481d02 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2761,7 +2761,7 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt, task = rpc_call_null_helper(clnt, xprt, NULL, RPC_TASK_ASYNC, &rpc_cb_add_xprt_call_ops, data); - + data->xps->xps_nunique_destaddr_xprts++; rpc_put_task(task); success: return 1; diff --git a/net/sunrpc/xprtmultipath.c b/net/sunrpc/xprtmultipath.c index 07e76ae1028a..584349c8cad4 100644 --- a/net/sunrpc/xprtmultipath.c +++ b/net/sunrpc/xprtmultipath.c @@ -138,6 +138,7 @@ struct rpc_xprt_switch *xprt_switch_alloc(struct rpc_xprt *xprt, xps->xps_iter_ops = &rpc_xprt_iter_singular; rpc_sysfs_xprt_switch_setup(xps, xprt, gfp_flags); xprt_switch_add_xprt_locked(xps, xprt); + xps->xps_nunique_destaddr_xprts = 1; rpc_sysfs_xprt_setup(xps, xprt, gfp_flags); } From patchwork Wed Jun 16 01:10:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12323599 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 E3FB6C49361 for ; Wed, 16 Jun 2021 01:10:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C922760230 for ; Wed, 16 Jun 2021 01:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231788AbhFPBM0 (ORCPT ); Tue, 15 Jun 2021 21:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229979AbhFPBMZ (ORCPT ); Tue, 15 Jun 2021 21:12:25 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E342C061574 for ; Tue, 15 Jun 2021 18:10:19 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id k9so714134qvu.13 for ; Tue, 15 Jun 2021 18:10:19 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=UR6Rd7myvHN8jhZL/Omyls/UlYm1JxgyxUCNaRwcqPM=; b=DomzEVfTa4IPgYqQhfxnVKkAZ9hk7bSSuMurr5iWVypr+oCpk6yO9rA1y20Q/zdtu4 7XYXOea6mTFmqshsfoHh5zxvZS8jpjN7KO7TKDaZ2OJRYH8Lzf/T7JaiwJUuEHJbChmV HhLRM7wWp8ott8VsYOjdsu+B8bDSAOAJ9VkekXZX4VDWaIABHLHn8Sx1k4O5Qm67oHp+ RpU4n3SF3BW453a9/GomgquJL9V4FcRrL/go4jUsiPrQ8BUqf+K51/LvLuefcoJDWZNZ ZkLfQO/s+J+nkpM97CjXpCkJWjIE3CaU9IsbX1FagaKO+ikj82fMtmDUTuxmEjpUMUIB PGxQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=UR6Rd7myvHN8jhZL/Omyls/UlYm1JxgyxUCNaRwcqPM=; b=OHfCBp8xALqn9wVUvNm+P83pt/+Nr+FlNc1oFT7IWesaRa9QcF2VgwelM7EJOwGA7O q3yxOUriLVqAI881kPHvbYkWRXjywylDVJ6mM6HUSMnypL5fZf115OcW4fkm1gHAwKIX a/7sr+QJz/eQMLo89MOwRPnD5UyggdQgwpQOb7RNZ22e+GVcj2qhe6uO+ioXBrTU/CxV ibkeXZitVqF/3lUU3bumlcAZ++R7JY58O1oKKwzRH/6SfD8CAiHqmxypC5b360AnZ56s VKayfKF6WqObECKNCOozqkvycWls6ke8M7rXHglaQRRahzOrUYDzh+BlhxSJFhBDZ62j SdIA== X-Gm-Message-State: AOAM533Ur6dIM1IOWuPXnNcrFCqkt6fAGtrFTG+NxqeT6STU+Ti2DB0t /5JSnQp1RhXD0wAkVyoZAD7KX6SZpuT81A== X-Google-Smtp-Source: ABdhPJxwkXEt7wOeDwmm2aPfkOB82AWUb8fG2UCUt9VQZ3VnxFS2zKo5srts4Rfx/QBPbLk+vsUgmg== X-Received: by 2002:ad4:4ae4:: with SMTP id cp4mr8444289qvb.44.1623805818771; Tue, 15 Jun 2021 18:10:18 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id m189sm546007qkd.107.2021.06.15.18.10.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jun 2021 18:10:18 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 2/6] SUNRPC add xps_nunique_destaddr_xprts to xprt_switch_info in sysfs Date: Tue, 15 Jun 2021 21:10:09 -0400 Message-Id: <20210616011013.50547-3-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210616011013.50547-1-olga.kornievskaia@gmail.com> References: <20210616011013.50547-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Olga Kornievskaia In sysfs's xprt_switch_info attribute also display the value of number of transports with unique destination addresses for this xprt_switch. Signed-off-by: Olga Kornievskaia --- net/sunrpc/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c index 2fbaba27d5c6..45c0cf18360d 100644 --- a/net/sunrpc/sysfs.c +++ b/net/sunrpc/sysfs.c @@ -164,8 +164,10 @@ static ssize_t rpc_sysfs_xprt_switch_info_show(struct kobject *kobj, if (!xprt_switch) return 0; - ret = sprintf(buf, "num_xprts=%u\nnum_active=%u\nqueue_len=%ld\n", + ret = sprintf(buf, "num_xprts=%u\nnum_active=%u\n" + "num_unique_destaddr=%u\nqueue_len=%ld\n", xprt_switch->xps_nxprts, xprt_switch->xps_nactive, + xprt_switch->xps_nunique_destaddr_xprts, atomic_long_read(&xprt_switch->xps_queuelen)); xprt_switch_put(xprt_switch); return ret + 1; From patchwork Wed Jun 16 01:10:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12323601 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 EA10CC48BDF for ; Wed, 16 Jun 2021 01:10:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D76BB60230 for ; Wed, 16 Jun 2021 01:10:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231800AbhFPBM1 (ORCPT ); Tue, 15 Jun 2021 21:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229979AbhFPBM0 (ORCPT ); Tue, 15 Jun 2021 21:12:26 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9D51C06175F for ; Tue, 15 Jun 2021 18:10:20 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id c18so906996qkc.11 for ; Tue, 15 Jun 2021 18:10:20 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=0C3XncB5gac/OTCtz1qZ9eL3c2bkAVJA0vgsKsB6j/g=; b=kpHJMhAfe3sf3B0OCZqvsHhj+PJmxiJIne4OWY69key9/Ga9TN+azvOvr5IPgTVSnn oc1I+oXlHhM7r5OvE26Hyh0EsgjWTcILcXJazz5eFABAM6KLsJScaePjStJozOA2S/Iu eWdkR4t9BKaruP50V3oBoBmcOTvZxdAKgcZBcOma6ShG7a7XXCUj/FiY20pEF05GOtP6 h0jXMT0lsMWHYoiF7h8eWZDsRXhhH+3SgFhHulsEzkT3l6vpU8nDxXH05k/L6hHOkzqo kikCF/h6fjo3Ph6YS3LgrqqtJxOWzonYaaU5RJBTyPB2aZpvSnjyhfTSOYs9SCCAuJ8Y WHeQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0C3XncB5gac/OTCtz1qZ9eL3c2bkAVJA0vgsKsB6j/g=; b=nE2fqZrBDqBP3xlrF0KjFh9InwWifDFnVb6wMcsXmGTbsbm8GHeXCaOFmLLZi4Swec 3RcVQh7qnJyqYaY0pH0ljjXbiKoOoTEg+z8F/B9YbgEpxkT9ZILL7uGqIMRLO6r+/3Hk 2PAXznptqAzkDaBiYNR+8CWR+bjVLVSyqPwfDm4lXmGnrktSSb2JStNgvNSMxNsic11w A0wmv01H7j5vNeIXcG80tDS3X2OeuNC+Drl6WuEfaKEQJjxRPsczAF/D0yyH5L+dRMeA SOOiq42ZRjyJm+1iCZ+B27+4DlASF2eGgYlnin9MMAlub00pWJO/pq35VA+tntdhMPXc cXwQ== X-Gm-Message-State: AOAM531Ce2Q/Qd1MIaE/ux6KNS394jojZ1ubcd/YKcK+wL0EHg1dkIgz nH0iScKuW00uHVIwbIy1mnCojAVMj5KWmw== X-Google-Smtp-Source: ABdhPJxqn1fOgr6fJAnT3gdPjMK4rrPQ3wDIU39wW5BtwIBTqOwd5pRqGxGRIoI7bizcU1teZdFtng== X-Received: by 2002:a05:620a:1127:: with SMTP id p7mr2529983qkk.197.1623805819863; Tue, 15 Jun 2021 18:10:19 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id m189sm546007qkd.107.2021.06.15.18.10.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jun 2021 18:10:19 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 3/6] NFSv4 introduce max_connect mount options Date: Tue, 15 Jun 2021 21:10:10 -0400 Message-Id: <20210616011013.50547-4-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210616011013.50547-1-olga.kornievskaia@gmail.com> References: <20210616011013.50547-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Olga Kornievskaia This option will control up to how many xprts can the client establish to the server with a distinct address (that means nconnect connections are not counted towards this new limit). This patch is setting up nfs structures to keeep track of the max_connect limit (does not enforce it). The default value is kept at 1 so that no current mounts that don't want any additional connections would be effected. The maximum value is set at 16. Mounts to DS are not limited to default value of 1 but instead set to the maximum default value of 16 (NFS_MAX_TRANSPORTS). Signed-off-by: Olga Kornievskaia --- fs/nfs/client.c | 1 + fs/nfs/fs_context.c | 7 +++++++ fs/nfs/internal.h | 2 ++ fs/nfs/nfs4client.c | 12 ++++++++++-- fs/nfs/super.c | 2 ++ include/linux/nfs_fs.h | 5 +++++ include/linux/nfs_fs_sb.h | 1 + 7 files changed, 28 insertions(+), 2 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 330f65727c45..486dec59972b 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -179,6 +179,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init) clp->cl_proto = cl_init->proto; clp->cl_nconnect = cl_init->nconnect; + clp->cl_max_connect = cl_init->max_connect ? cl_init->max_connect : 1; clp->cl_net = get_net(cl_init->net); clp->cl_principal = "*"; diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c index d95c9a39bc70..0d444a90f513 100644 --- a/fs/nfs/fs_context.c +++ b/fs/nfs/fs_context.c @@ -60,6 +60,7 @@ enum nfs_param { Opt_mountvers, Opt_namelen, Opt_nconnect, + Opt_max_connect, Opt_port, Opt_posix, Opt_proto, @@ -158,6 +159,7 @@ static const struct fs_parameter_spec nfs_fs_parameters[] = { fsparam_u32 ("mountvers", Opt_mountvers), fsparam_u32 ("namlen", Opt_namelen), fsparam_u32 ("nconnect", Opt_nconnect), + fsparam_u32 ("max_connect", Opt_max_connect), fsparam_string("nfsvers", Opt_vers), fsparam_u32 ("port", Opt_port), fsparam_flag_no("posix", Opt_posix), @@ -770,6 +772,11 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, goto out_of_bounds; ctx->nfs_server.nconnect = result.uint_32; break; + case Opt_max_connect: + if (result.uint_32 < 1 || result.uint_32 > NFS_MAX_TRANSPORTS) + goto out_of_bounds; + ctx->nfs_server.max_connect = result.uint_32; + break; case Opt_lookupcache: switch (result.uint_32) { case Opt_lookupcache_all: diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index a36af04188c2..66fc936834f2 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -67,6 +67,7 @@ struct nfs_client_initdata { int proto; u32 minorversion; unsigned int nconnect; + unsigned int max_connect; struct net *net; const struct rpc_timeout *timeparms; const struct cred *cred; @@ -121,6 +122,7 @@ struct nfs_fs_context { int port; unsigned short protocol; unsigned short nconnect; + unsigned short max_connect; unsigned short export_path_len; } nfs_server; diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 28431acd1230..270caa1805a2 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -865,6 +865,7 @@ static int nfs4_set_client(struct nfs_server *server, const char *ip_addr, int proto, const struct rpc_timeout *timeparms, u32 minorversion, unsigned int nconnect, + unsigned int max_connect, struct net *net) { struct nfs_client_initdata cl_init = { @@ -883,6 +884,8 @@ static int nfs4_set_client(struct nfs_server *server, if (minorversion == 0) __set_bit(NFS_CS_REUSEPORT, &cl_init.init_flags); + else + cl_init.max_connect = max_connect; if (proto == XPRT_TRANSPORT_TCP) cl_init.nconnect = nconnect; @@ -952,8 +955,10 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_server *mds_srv, return ERR_PTR(-EINVAL); cl_init.hostname = buf; - if (mds_clp->cl_nconnect > 1 && ds_proto == XPRT_TRANSPORT_TCP) + if (mds_clp->cl_nconnect > 1 && ds_proto == XPRT_TRANSPORT_TCP) { cl_init.nconnect = mds_clp->cl_nconnect; + cl_init.max_connect = NFS_MAX_TRANSPORTS; + } if (mds_srv->flags & NFS_MOUNT_NORESVPORT) __set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); @@ -1122,6 +1127,7 @@ static int nfs4_init_server(struct nfs_server *server, struct fs_context *fc) &timeparms, ctx->minorversion, ctx->nfs_server.nconnect, + ctx->nfs_server.max_connect, fc->net_ns); if (error < 0) return error; @@ -1211,6 +1217,7 @@ struct nfs_server *nfs4_create_referral_server(struct fs_context *fc) parent_server->client->cl_timeout, parent_client->cl_mvops->minor_version, parent_client->cl_nconnect, + parent_client->cl_max_connect, parent_client->cl_net); if (!error) goto init_server; @@ -1226,6 +1233,7 @@ struct nfs_server *nfs4_create_referral_server(struct fs_context *fc) parent_server->client->cl_timeout, parent_client->cl_mvops->minor_version, parent_client->cl_nconnect, + parent_client->cl_max_connect, parent_client->cl_net); if (error < 0) goto error; @@ -1323,7 +1331,7 @@ int nfs4_update_server(struct nfs_server *server, const char *hostname, error = nfs4_set_client(server, hostname, sap, salen, buf, clp->cl_proto, clnt->cl_timeout, clp->cl_minorversion, - clp->cl_nconnect, net); + clp->cl_nconnect, clp->cl_max_connect, net); clear_bit(NFS_MIG_TSM_POSSIBLE, &server->mig_status); if (error != 0) { nfs_server_insert_lists(server); diff --git a/fs/nfs/super.c b/fs/nfs/super.c index fe58525cfed4..e65c83494c05 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -480,6 +480,8 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss, if (clp->cl_nconnect > 0) seq_printf(m, ",nconnect=%u", clp->cl_nconnect); if (version == 4) { + if (clp->cl_max_connect > 1) + seq_printf(m, ",max_connect=%u", clp->cl_max_connect); if (nfss->port != NFS_PORT) seq_printf(m, ",port=%u", nfss->port); } else diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index ffba254d2098..c13414a8dfde 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -40,6 +40,11 @@ #include +/* + * These are the default for number of transports to different server IPs + */ +#define NFS_MAX_TRANSPORTS 16 + /* * These are the default flags for swap requests */ diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index d71a0e90faeb..2a9acbfe00f0 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -62,6 +62,7 @@ struct nfs_client { u32 cl_minorversion;/* NFSv4 minorversion */ unsigned int cl_nconnect; /* Number of connections */ + unsigned int cl_max_connect; /* max number of xprts allowed */ const char * cl_principal; /* used for machine cred */ #if IS_ENABLED(CONFIG_NFS_V4) From patchwork Wed Jun 16 01:10:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12323603 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 30CC6C48BE5 for ; Wed, 16 Jun 2021 01:10:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1712F60230 for ; Wed, 16 Jun 2021 01:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229979AbhFPBM1 (ORCPT ); Tue, 15 Jun 2021 21:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231805AbhFPBM1 (ORCPT ); Tue, 15 Jun 2021 21:12:27 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90808C061574 for ; Tue, 15 Jun 2021 18:10:21 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id r7so574771qta.12 for ; Tue, 15 Jun 2021 18:10:21 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=tc2zBWsP5SICZ7IcIxQSVb38r0cPHyPwbwo/tclHPvc=; b=HovIgOySUEnxTTrc4WGZ4x8cqKFkltE54qarxpXRRz/JR3xIW1tBZjTeEzhkVsW+cC HptFKc5oVFGfb3Mcx9+zc56KGbTO7kuFlMAlQkbCF6Q7kU7XjSfM0EfHHD60lkBB6SRp 6rfSqql09SlscUmUrQAEJRRCvEYvwdOVtCe4OdC67Fe21jMC1e9ct43rb76lTJ7JR6KY omq272LByg178e67j91iigZfOmVF2IacfFUAgQ7/SMzCz672vn20jRgAf2gbW5fhB5iJ l2lVm0rqKG4ipx4wSTDYA0K5VXWLNeyvSC7ohbR0SgwpBdMlo1thZNdywDLT7XIMjvlo 55Cw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=tc2zBWsP5SICZ7IcIxQSVb38r0cPHyPwbwo/tclHPvc=; b=L7VNEo2DVye2og3dQrpZS8Ux8nqA7MnXVjR4ZyvPznwJA4rWF0dhT/D0S6ShRudBfF oD6A9M2BrdNUQI3TvXEv+7xFGr4s3GPkhLia8XYGOjxFv0SPtn9a4BGh75QZZ6kNjoXE El/aoo5/JWwn5D3EYn2bQEpEl3/g0fbKdtKiQ4x9olIOTQpBa6LiTmyaHR8sZ/B/HyQO tr+kgd58jw2R9BXcxhoSbbqBLuQGlOlScLC9prvbWPSOrhNOI3DPEwK4HON1IwGZDnDo 3cU1Zw2keWlvMHiuaDuyvB1K/7XcYT483s77SUZ11fpQ/weoeeTcDDzVfe6UrWcM4MJI vgfA== X-Gm-Message-State: AOAM531oGZM+FRwebC+UDJEwTdaTPPAuLY9nVBTtflIGbuO+lmGzSVPA BzQ9s7l4MU36vVHS3p5FB76xSLOPGvdPqA== X-Google-Smtp-Source: ABdhPJw8UwYmaUYwrMcTumo+F7gcEAbbtlOwXxVVDx+TjOls7cbGgkVxBw0VHfN+hLgHRBL6IzjvuQ== X-Received: by 2002:ac8:7399:: with SMTP id t25mr2515654qtp.228.1623805820774; Tue, 15 Jun 2021 18:10:20 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id m189sm546007qkd.107.2021.06.15.18.10.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jun 2021 18:10:20 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 4/6] SUNRPC enforce creation of no more than max_connect xprts Date: Tue, 15 Jun 2021 21:10:11 -0400 Message-Id: <20210616011013.50547-5-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210616011013.50547-1-olga.kornievskaia@gmail.com> References: <20210616011013.50547-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Olga Kornievskaia If we are adding new transports via rpc_clnt_test_and_add_xprt() then check if we've reached the limit. Currently only pnfs path adds transports via that function but this is done in preparation when the client would add new transports when session trunking is detected. A warning is logged if the limit is reached. Signed-off-by: Olga Kornievskaia --- fs/nfs/client.c | 1 + include/linux/sunrpc/clnt.h | 2 ++ net/sunrpc/clnt.c | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 486dec59972b..23e165d5ec9c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -541,6 +541,7 @@ int nfs_create_rpc_client(struct nfs_client *clp, clnt->cl_principal = clp->cl_principal; clp->cl_rpcclient = clnt; + clnt->cl_max_connect = clp->cl_max_connect; return 0; } EXPORT_SYMBOL_GPL(nfs_create_rpc_client); diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 8b5d5c97553e..0bbf873b225a 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -81,6 +81,7 @@ struct rpc_clnt { struct work_struct cl_work; }; const struct cred *cl_cred; + unsigned int cl_max_connect; /* max number of transports not to the same IP */ }; /* @@ -135,6 +136,7 @@ struct rpc_create_args { char *client_name; struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ const struct cred *cred; + unsigned int max_connect; }; struct rpc_add_xprt_test { diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index e6801a481d02..4d8fd9d9c264 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2749,6 +2749,15 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt, struct rpc_cb_add_xprt_calldata *data; struct rpc_task *task; + if (xps->xps_nunique_destaddr_xprts + 1 > clnt->cl_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, + rcu_dereference(xprt->address_strings[RPC_DISPLAY_ADDR])); + rcu_read_unlock(); + return -EINVAL; + } + data = kmalloc(sizeof(*data), GFP_NOFS); if (!data) return -ENOMEM; From patchwork Wed Jun 16 01:10:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12323605 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 D6686C49EA2 for ; Wed, 16 Jun 2021 01:10:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C26A060230 for ; Wed, 16 Jun 2021 01:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231806AbhFPBM2 (ORCPT ); Tue, 15 Jun 2021 21:12:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231805AbhFPBM1 (ORCPT ); Tue, 15 Jun 2021 21:12:27 -0400 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9752C061574 for ; Tue, 15 Jun 2021 18:10:22 -0700 (PDT) Received: by mail-qv1-xf31.google.com with SMTP id f5so732905qvu.8 for ; Tue, 15 Jun 2021 18:10:22 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=vIOWLAR5baQ4wudUHjXS8yJqf6XzOgQ0+NlfjuEdhJQ=; b=VRJrGLy3RirE6u1SyrUiEpJ3+QC2TTSsnVwvLIaKFDSlIVJfCPmzvKhpDZFh4/RbRs nnnEq87U3Wq5A/utCYTnCj2ZvWXpvBklLf/5JuNvCi30G6EvV+sialAajM7QY/hbYQN/ ro2GiEN5CG2tuGm0fxB9VRjHSTHTVvVJS6HlWeoKocWAYQE63K/SAfB2dHbLuKik/2Q8 D3n1mhY5SW3jBFmLyAttCTOSkBXM32Capuy6yALks/Py/ajOzzVByOdlkkOPVAEJNkvv 8Ke1z5U5HKDz458pCHJbhDaByaaHf7INdq2gK+JFaAjIQRTXmURd4ekI3mW4p/VgsLQ2 6FhA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=vIOWLAR5baQ4wudUHjXS8yJqf6XzOgQ0+NlfjuEdhJQ=; b=j+hL8ls+oXBbfx6+E7G9u6oYWAVPM3i/ipbR9W2AokIIDMfa+k3g2300aQuhfvuKtJ Y4nxhqjfHJppiFzj0VFK1plEIJ52hJD3ARRyoN/WI5WcnUdBGpoTmZtfAR2qnc4Q8coK MVXZBtOw/NdPZPGMWLz3wzEcbOamqSzTbTsTN/4ZAetsjvgcoivm98hUOMr0dcpnsJAT JUlyrIzYeI8SvrQgbLM+0mRYFM4Jb2BjMO04jWTWHVOSSxQ7LflcTWd4lh82jcJyy+hW XD09g1/1M3Xk5u+mBEkpa7fxl407yAOAfg9gMr+09dhuW1Pyc4xe1yRn8rnPM7Uh9SoV TJZQ== X-Gm-Message-State: AOAM530nKp/yxSWwH9XLT9nehoGCI6OZS/D+4iAJzkdGajhHf526AqAi gF53scNy1aXANwhkM/6HHwObdismDjdtUw== X-Google-Smtp-Source: ABdhPJyM5RPi1t2jR7Iqu3ls77YFVn/YjU+lioREyVitfZgSQJls6e/IZXrIKZMqagwSbK7lJJLb7Q== X-Received: by 2002:ad4:4241:: with SMTP id l1mr8307729qvq.2.1623805821896; Tue, 15 Jun 2021 18:10:21 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id m189sm546007qkd.107.2021.06.15.18.10.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jun 2021 18:10:21 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 5/6] NFSv4 add network transport when session trunking is detected Date: Tue, 15 Jun 2021 21:10:12 -0400 Message-Id: <20210616011013.50547-6-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210616011013.50547-1-olga.kornievskaia@gmail.com> References: <20210616011013.50547-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 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 if the allowed limit of transports has not been reached. An example: there exists a multi-homed server and client mounts one server address and some volume and then doest another mount to a different address of the same server and perhaps a different volume. Previously, the client checks that this is a session trunkable servers (same server), and removes the newly created client structure along with its transport. Now, the client adds the connection from the 2nd mount into the xprt switch of the existing client (it leads to having 2 available connections). Signed-off-by: Olga Kornievskaia --- fs/nfs/nfs4client.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 270caa1805a2..af57332503be 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -402,6 +402,33 @@ 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; + struct xprt_create xprt_args = { + .ident = old->cl_proto, + .net = old->cl_net, + .servername = old->cl_hostname, + }; + + if (clp->cl_proto != old->cl_proto) + return; + clp_salen = rpc_peeraddr(clp->cl_rpcclient, clp_sap, sizeof(clp_addr)); + 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; + + rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args, + rpc_clnt_test_and_add_xprt, NULL); +} + /** * nfs4_init_client - Initialise an NFS4 client record * @@ -436,6 +463,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); From patchwork Wed Jun 16 01:10:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12323607 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 C5641C48BE5 for ; Wed, 16 Jun 2021 01:10:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE88B60230 for ; Wed, 16 Jun 2021 01:10:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231809AbhFPBMa (ORCPT ); Tue, 15 Jun 2021 21:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231805AbhFPBM3 (ORCPT ); Tue, 15 Jun 2021 21:12:29 -0400 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0F14C061574 for ; Tue, 15 Jun 2021 18:10:23 -0700 (PDT) Received: by mail-qk1-x72a.google.com with SMTP id u30so935959qke.7 for ; Tue, 15 Jun 2021 18:10:23 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=0vWcJCJxN2zJiTTQMTjQVGAA4Clv5uDSLIsXFO1UYJk=; b=h8erflNbs0QlMaYgZlXUyLNxzFHfIa00p6BSd+c35c4BMGQaBSyiSzqpmC8tiLKm4E prdArLc9WgYzlZnzrzdVs17ZIU7DG7NncfJNe323UHIrNtQXJqdyJBttpAB8R3EBxZAG GzN/gEECf0X4DGi1hDPdho0+aMID/htv9DE4Tg1kmKh2Z9LvHgEQ+Pvj8PeEz8+MQXL3 cEugy1jOxeIfR76iOtAbj94Aup9knFtSnWTJJ9Un3VCDeIMLamg3cqjBXd+phOI+CyAc qJ8jB5kutDy2E/2t5xUg4xRis4ZL+E6XsRCWI6kNft90PtUBkdccI2cC5zuw2UWLePhU Z+qA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0vWcJCJxN2zJiTTQMTjQVGAA4Clv5uDSLIsXFO1UYJk=; b=a6svZd0v7z9Ca1i4kMXxITV5h0pFDXCyldvomI/wecZ9u2HKRp7EkzfxaFOrOHIYgy eUBo2DlNNUeMQIT4n/4bWGLlQ2nSrxVcSRFV1lIBDW3LGcckFqFlHkkx00WdUJP7Qn6E qphN2zK+kl2HGRzdAwtf1tHTTTidMEOByOHUat9f55dc/aCnz8jHx3/c7+Jy+SH9meZK gKtwjk6burjwKFI4TiPWwSrOXQAyMNH0BfjE0u6p1sfFdKfYjUT4Wha2qeggevFf6kk4 ylu/tZBN6OfXuQS/TRgoR3/fKTq/ghkghAdp1dSOHSqX5x4hQgs3CLmZp/lcuNja3TjW 12vw== X-Gm-Message-State: AOAM533xflmA9AxQUcuFv4AiAGDjQy7QDbzlhYEOETqm4l+wrFlJ5Kst /1IPXIMzMkVktLNpq+9N0XU= X-Google-Smtp-Source: ABdhPJwsdfNoxEPj8uELqu08EUbbpklvy0gArb4gOD/nGXqVcelhW6QeDvS8yBpqu/cZhvNGIfg19g== X-Received: by 2002:ae9:e415:: with SMTP id q21mr2552530qkc.121.1623805822975; Tue, 15 Jun 2021 18:10:22 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id m189sm546007qkd.107.2021.06.15.18.10.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jun 2021 18:10:22 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 6/6] NFSv4 allow for nconnect value of trunkable transport Date: Tue, 15 Jun 2021 21:10:13 -0400 Message-Id: <20210616011013.50547-7-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210616011013.50547-1-olga.kornievskaia@gmail.com> References: <20210616011013.50547-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Olga Kornievskaia If the new mount asked for nconnect mount, then create old client number of connections to the destination address that has been established as the same server with trunkable address. Signed-off-by: Olga Kornievskaia --- There might be a number of objection to this patch. One I can think of is that this patch creates the nconnects based on whether or not the new mount asked for nconnect instead of unconditionally creating nconnect number of connections. The patch still creates nconnect connections based on the original value instead of picking the value of clp->cl_nconnect. I would have preferred that would be done. I don't see what can be wrong with using the new value. But I feared to go against what was objected before. My preference would be to (1) create clp->cl_nconnect connections or (2) not use this patch at all or (3) use as is here (meaning at least not create extra connections unless asked for by the mount). --- fs/nfs/nfs4client.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index af57332503be..50fa9d53b444 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -427,6 +427,15 @@ static void nfs4_add_trunk(struct nfs_client *clp, struct nfs_client *old) rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args, rpc_clnt_test_and_add_xprt, NULL); + + if (clp->cl_nconnect > 1) { + int i; + + for (i = 0; i < old->cl_nconnect - 1; i++) + if (rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args, + NULL, NULL) < 0) + break; + } } /**