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

Commit a72b4422 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

NFSv4: Allow user to set the port used by the NFSv4 callback channel

parent a895b4a1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -910,6 +910,10 @@ running once the system is up.
	nfsroot=	[NFS] nfs root filesystem for disk-less boxes.
			See Documentation/nfsroot.txt.

	nfs.callback_tcpport=
			[NFS] set the TCP port on which the NFSv4 callback
			channel should listen.

	nmi_watchdog=	[KNL,BUGS=IA-32] Debugging features for SMP kernels

	no387		[BUGS=IA-32] Tells the kernel to use the 387 maths
+1 −0
Original line number Diff line number Diff line
@@ -13,4 +13,5 @@ nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \
			   delegation.o idmap.o \
			   callback.o callback_xdr.o callback_proc.o
nfs-$(CONFIG_NFS_DIRECTIO) += direct.o
nfs-$(CONFIG_SYSCTL) += sysctl.o
nfs-objs		:= $(nfs-y)
+2 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ static struct nfs_callback_data nfs_callback_info;
static DECLARE_MUTEX(nfs_callback_sema);
static struct svc_program nfs4_callback_program;

unsigned int nfs_callback_set_tcpport;
unsigned short nfs_callback_tcpport;

/*
@@ -98,7 +99,7 @@ int nfs_callback_up(void)
	if (!serv)
		goto out_err;
	/* FIXME: We don't want to register this socket with the portmapper */
	ret = svc_makesock(serv, IPPROTO_TCP, 0);
	ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport);
	if (ret < 0)
		goto out_destroy;
	if (!list_empty(&serv->sv_permsocks)) {
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ extern unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy);
extern int nfs_callback_up(void);
extern int nfs_callback_down(void);

extern unsigned int nfs_callback_set_tcpport;
extern unsigned short nfs_callback_tcpport;

#endif /* __LINUX_FS_NFS_CALLBACK_H */
+35 −2
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include <asm/uaccess.h>

#include "nfs4_fs.h"
#include "callback.h"
#include "delegation.h"

#define NFSDBG_FACILITY		NFSDBG_VFS
@@ -2036,6 +2037,21 @@ static struct file_system_type nfs4_fs_type = {
	.fs_flags	= FS_ODD_RENAME|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
};

static const int nfs_set_port_min = 0;
static const int nfs_set_port_max = 65535;
static int param_set_port(const char *val, struct kernel_param *kp)
{
	char *endp;
	int num = simple_strtol(val, &endp, 0);
	if (endp == val || *endp || num < nfs_set_port_min || num > nfs_set_port_max)
		return -EINVAL;
	*((int *)kp->arg) = num;
	return 0;
}

module_param_call(callback_tcpport, param_set_port, param_get_int,
		 &nfs_callback_set_tcpport, 0644);

#define nfs4_init_once(nfsi) \
	do { \
		INIT_LIST_HEAD(&(nfsi)->open_states); \
@@ -2043,8 +2059,25 @@ static struct file_system_type nfs4_fs_type = {
		nfsi->delegation_state = 0; \
		init_rwsem(&nfsi->rwsem); \
	} while(0)
#define register_nfs4fs() register_filesystem(&nfs4_fs_type)
#define unregister_nfs4fs() unregister_filesystem(&nfs4_fs_type)

static inline int register_nfs4fs(void)
{
	int ret;

	ret = nfs_register_sysctl();
	if (ret != 0)
		return ret;
	ret = register_filesystem(&nfs4_fs_type);
	if (ret != 0)
		nfs_unregister_sysctl();
	return ret;
}

static inline void unregister_nfs4fs(void)
{
	unregister_filesystem(&nfs4_fs_type);
	nfs_unregister_sysctl();
}
#else
#define nfs4_init_once(nfsi) \
	do { } while (0)
Loading