Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5405fc44 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker
Browse files

NFSv4.x: Add kernel parameter to control the callback server



Add support for the kernel parameter nfs.callback_nr_threads to set
the number of threads that will be assigned to the callback channel.

Add support for the kernel parameter nfs.nfs.max_session_cb_slots
to set the maximum size of the callback channel slot table.

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent bb6aeba7
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -2420,6 +2420,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
	nfsrootdebug	[NFS] enable nfsroot debugging messages.
	nfsrootdebug	[NFS] enable nfsroot debugging messages.
			See Documentation/filesystems/nfs/nfsroot.txt.
			See Documentation/filesystems/nfs/nfsroot.txt.


	nfs.callback_nr_threads=
			[NFSv4] set the total number of threads that the
			NFS client will assign to service NFSv4 callback
			requests.

	nfs.callback_tcpport=
	nfs.callback_tcpport=
			[NFS] set the TCP port on which the NFSv4 callback
			[NFS] set the TCP port on which the NFSv4 callback
			channel should listen.
			channel should listen.
@@ -2443,6 +2448,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
			of returning the full 64-bit number.
			of returning the full 64-bit number.
			The default is to return 64-bit inode numbers.
			The default is to return 64-bit inode numbers.


	nfs.max_session_cb_slots=
			[NFSv4.1] Sets the maximum number of session
			slots the client will assign to the callback
			channel. This determines the maximum number of
			callbacks the client will process in parallel for
			a particular server.

	nfs.max_session_slots=
	nfs.max_session_slots=
			[NFSv4.1] Sets the maximum number of session slots
			[NFSv4.1] Sets the maximum number of session slots
			the client will attempt to negotiate with the server.
			the client will attempt to negotiate with the server.
+4 −1
Original line number Original line Diff line number Diff line
@@ -148,11 +148,14 @@ static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
				  struct svc_serv *serv)
				  struct svc_serv *serv)
{
{
	const int nrservs = NFS4_NR_CALLBACK_THREADS;
	int nrservs = nfs_callback_nr_threads;
	int ret;
	int ret;


	nfs_callback_bc_serv(minorversion, xprt, serv);
	nfs_callback_bc_serv(minorversion, xprt, serv);


	if (nrservs < NFS4_MIN_NR_CALLBACK_THREADS)
		nrservs = NFS4_MIN_NR_CALLBACK_THREADS;

	if (serv->sv_nrthreads-1 == nrservs)
	if (serv->sv_nrthreads-1 == nrservs)
		return 0;
		return 0;


+2 −1
Original line number Original line Diff line number Diff line
@@ -198,8 +198,9 @@ extern void nfs_callback_down(int minorversion, struct net *net);
#define NFS41_BC_MIN_CALLBACKS 1
#define NFS41_BC_MIN_CALLBACKS 1
#define NFS41_BC_MAX_CALLBACKS 1
#define NFS41_BC_MAX_CALLBACKS 1


#define NFS4_NR_CALLBACK_THREADS 1
#define NFS4_MIN_NR_CALLBACK_THREADS 1


extern unsigned int nfs_callback_set_tcpport;
extern unsigned int nfs_callback_set_tcpport;
extern unsigned short nfs_callback_nr_threads;


#endif /* __LINUX_FS_NFS_CALLBACK_H */
#endif /* __LINUX_FS_NFS_CALLBACK_H */
+1 −0
Original line number Original line Diff line number Diff line
@@ -471,6 +471,7 @@ extern struct nfs_subversion nfs_v4;
struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct nfs_subversion *);
struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct nfs_subversion *);
extern bool nfs4_disable_idmapping;
extern bool nfs4_disable_idmapping;
extern unsigned short max_session_slots;
extern unsigned short max_session_slots;
extern unsigned short max_session_cb_slots;
extern unsigned short send_implementation_id;
extern unsigned short send_implementation_id;
extern bool recover_lost_locks;
extern bool recover_lost_locks;


+3 −4
Original line number Original line Diff line number Diff line
@@ -7463,7 +7463,7 @@ static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args,
	args->bc_attrs.max_resp_sz = max_bc_payload;
	args->bc_attrs.max_resp_sz = max_bc_payload;
	args->bc_attrs.max_resp_sz_cached = 0;
	args->bc_attrs.max_resp_sz_cached = 0;
	args->bc_attrs.max_ops = NFS4_MAX_BACK_CHANNEL_OPS;
	args->bc_attrs.max_ops = NFS4_MAX_BACK_CHANNEL_OPS;
	args->bc_attrs.max_reqs = NFS41_BC_MAX_CALLBACKS;
	args->bc_attrs.max_reqs = min_t(unsigned short, max_session_cb_slots, 1);


	dprintk("%s: Back Channel : max_rqst_sz=%u max_resp_sz=%u "
	dprintk("%s: Back Channel : max_rqst_sz=%u max_resp_sz=%u "
		"max_resp_sz_cached=%u max_ops=%u max_reqs=%u\n",
		"max_resp_sz_cached=%u max_ops=%u max_reqs=%u\n",
@@ -7510,10 +7510,9 @@ static int nfs4_verify_back_channel_attrs(struct nfs41_create_session_args *args
		return -EINVAL;
		return -EINVAL;
	if (rcvd->max_resp_sz_cached > sent->max_resp_sz_cached)
	if (rcvd->max_resp_sz_cached > sent->max_resp_sz_cached)
		return -EINVAL;
		return -EINVAL;
	/* These would render the backchannel useless: */
	if (rcvd->max_ops > sent->max_ops)
	if (rcvd->max_ops != sent->max_ops)
		return -EINVAL;
		return -EINVAL;
	if (rcvd->max_reqs != sent->max_reqs)
	if (rcvd->max_reqs > sent->max_reqs)
		return -EINVAL;
		return -EINVAL;
out:
out:
	return 0;
	return 0;
Loading