Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp149216pxj; Wed, 9 Jun 2021 19:24:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFjSvy09qPh/TIytS2ECdkZhE81rmzD+NXIiv9CJ036m2uUOZxiEwWE5foL0k8key+QxLC X-Received: by 2002:a17:906:d97:: with SMTP id m23mr2407161eji.392.1623291893255; Wed, 09 Jun 2021 19:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623291893; cv=none; d=google.com; s=arc-20160816; b=YBXCgX7kjs+TBvuWsSaz3vJ/e7u5QmDukv4FFHW7aY0nXdm/dNLaj6o1KlFmg4Qswj I4zCOw7hSnCR/I7d69sbGbQhTrEjNxyBUV5XylZkZIIYFN7+pIAK7fZHDwQfOTVxo8uL S1Kftm+NQi1cBPXMyarOfEepdNx4i5Ss4kQ9ix9Ca6oqphVYGQd9vJUPY/JrBJJOTt97 /n6keghYvQ9MciRcauScSuHHfqCtXNWQP9eYXLxmS4i5aaKxeWpnyNUaRlgYkirPODtx sxbUclULzI3vBexXOHyRvSCZBQRSg0TFXe6hTk4n2JyfDGgZyLKnQYxhi2C6gMkDKQuL Z61Q== 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:references:in-reply-to:subject:to:from:date; bh=YgNGxY2ZoMNg65HhMoDVD7l3kdiVbufeuOxvv6NfRzg=; b=gI0ZajqLMAD289LLzJfqB2NkWNJvV5pbSbeGNYtCp/Q69znXKT39q/7K+gZmME0S9t +EwZ9Iu38bEYO8bk1yodGZa+zcAPpszccUO2ACv5l+Ok9J28Ikmcc8npErjZw3IPLxSH Yu9PXaZAoKh3giMW1rpy6C8HNg++Gp2IMD9s9cFOkNYwSf9nArAdFDOVNu+SANQnnMKX L5S9SH04V4l0RQtg6JfTyQkk8+mdG7BQ7DT5T/44n9Fwij2D1R+AefK14ifZ2zOObfHA i8W7sR4cwiQ6wXiGsMkDefERXa+U7AWgEeaGVLthgmJwhO8kKoGUcZbj/MBYo3gFvzwM LGoA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp12si1225453ejc.245.2021.06.09.19.23.52; Wed, 09 Jun 2021 19:24:53 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbhFJCYZ (ORCPT + 99 others); Wed, 9 Jun 2021 22:24:25 -0400 Received: from out20-39.mail.aliyun.com ([115.124.20.39]:40875 "EHLO out20-39.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbhFJCYZ (ORCPT ); Wed, 9 Jun 2021 22:24:25 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.04436282|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.14542-0.00157672-0.853003;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047208;MF=wangyugui@e16-tech.com;NM=1;PH=DS;RN=4;RT=4;SR=0;TI=SMTPD_---.KQCZafI_1623291747; Received: from 192.168.2.112(mailfrom:wangyugui@e16-tech.com fp:SMTPD_---.KQCZafI_1623291747) by smtp.aliyun-inc.com(10.147.42.197); Thu, 10 Jun 2021 10:22:28 +0800 Date: Thu, 10 Jun 2021 10:22:30 +0800 From: Wang Yugui To: Olga Kornievskaia , trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, linux-nfs@vger.kernel.org Subject: Re: [PATCH v2 2/3] NFSv4 introduce max_connect mount options In-Reply-To: <20210610094912.4D54.409509F4@e16-tech.com> References: <20210609215319.5518-3-olga.kornievskaia@gmail.com> <20210610094912.4D54.409509F4@e16-tech.com> Message-Id: <20210610102229.4D5B.409509F4@e16-tech.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.75.04 [en] Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi, > We could extend 'nconnect' option rather than a new option 'max_connect'? > > max of nconnect is 16 when trunk support of single ip (kernel 5.3-5.?). > max of nconnect is 64 when trunk support of multiple ip (kernel 5.?-). I'm sorry that is a bad idea. we still need 'nconnect' for single ip. 'nconnect' have a default value of '1', but 'max_connect' may have a default value of '256' or '128', even hard-coded in nfs server. Best Regards Wang Yugui (wangyugui@e16-tech.com) 2021/06/10 > Best Regards > Wang Yugui (wangyugui@e16-tech.com) > 2021/06/10 > > > From: Olga Kornievskaia > > > > This option will control up to how many xprts can the client > > establish to the server. This patch parses the value and sets > > up structures that keep track of max_connect. > > > > Signed-off-by: Olga Kornievskaia > > --- > > fs/nfs/client.c | 1 + > > fs/nfs/fs_context.c | 8 ++++++++ > > fs/nfs/internal.h | 2 ++ > > fs/nfs/nfs4client.c | 12 ++++++++++-- > > fs/nfs/super.c | 2 ++ > > include/linux/nfs_fs_sb.h | 1 + > > 6 files changed, 24 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..cfbff7098f8e 100644 > > --- a/fs/nfs/fs_context.c > > +++ b/fs/nfs/fs_context.c > > @@ -29,6 +29,7 @@ > > #endif > > > > #define NFS_MAX_CONNECTIONS 16 > > +#define NFS_MAX_TRANSPORTS 128 > > > > enum nfs_param { > > Opt_ac, > > @@ -60,6 +61,7 @@ enum nfs_param { > > Opt_mountvers, > > Opt_namelen, > > Opt_nconnect, > > + Opt_max_connect, > > Opt_port, > > Opt_posix, > > Opt_proto, > > @@ -158,6 +160,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 +773,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 42719384e25f..640c8235d817 100644 > > --- a/fs/nfs/nfs4client.c > > +++ b/fs/nfs/nfs4client.c > > @@ -863,6 +863,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 = { > > @@ -881,6 +882,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; > > > > @@ -950,8 +953,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 = mds_clp->cl_max_connect; > > + } > > > > if (mds_srv->flags & NFS_MOUNT_NORESVPORT) > > __set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); > > @@ -1120,6 +1125,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; > > @@ -1209,6 +1215,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; > > @@ -1224,6 +1231,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; > > @@ -1321,7 +1329,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_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) > > -- > > 2.27.0 >