Add kernel module support for nfslockd and krpc. Use the module system

to detect (or load) kernel NLM support in rpc.lockd. Remove the '-k'
option to rpc.lockd and make kernel NLM the default. A user can still
force the use of the old user NLM by building a kernel without NFSLOCKD
and/or removing the nfslockd.ko module.
This commit is contained in:
Doug Rabson 2008-03-27 11:54:20 +00:00
parent e483943791
commit fa9d9930ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177662
22 changed files with 74 additions and 11 deletions

View File

@ -39,6 +39,7 @@ options UFS_GJOURNAL # Enable gjournal-based UFS journaling
options MD_ROOT # MD is a potential root device
options NFSCLIENT # Network Filesystem Client
options NFSSERVER # Network Filesystem Server
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCLIENT
options NTFS # NT File System
options MSDOSFS # MSDOS Filesystem

View File

@ -57,6 +57,7 @@ options UFS_ACL #Support for access control lists
options UFS_DIRHASH #Improve performance on big directories
options NFSCLIENT #Network Filesystem Client
options NFSSERVER #Network Filesystem Server
options NFSLOCKD #Network Lock Manager
options NFS_ROOT #NFS usable as /, requires NFSCLIENT
#options MSDOSFS #MSDOS Filesystem
options CD9660 #ISO 9660 Filesystem

View File

@ -48,6 +48,7 @@ options SOFTUPDATES #Enable FFS soft updates support
#options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\"
options NFSCLIENT #Network Filesystem Client
#options NFSSERVER #Network Filesystem Server
#options NFSLOCKD #Network Lock Manager
options NFS_ROOT #NFS usable as /, requires NFSCLIENT
options BOOTP_NFSROOT
options BOOTP

View File

@ -45,6 +45,7 @@ options UFS_ACL #Support for access control lists
options UFS_DIRHASH #Improve performance on big directories
options NFSCLIENT #Network Filesystem Client
options NFSSERVER #Network Filesystem Server
options NFSLOCKD #Network Lock Manager
options NFS_ROOT #NFS usable as /, requires NFSCLIENT
#options MSDOSFS #MSDOS Filesystem
options CD9660 #ISO 9660 Filesystem

View File

@ -44,6 +44,7 @@ options UFS_ACL #Support for access control lists
options UFS_DIRHASH #Improve performance on big directories
options NFSCLIENT #Network Filesystem Client
options NFSSERVER #Network Filesystem Server
options NFSLOCKD #Network Lock Manager
options NFS_ROOT #NFS usable as /, requires NFSCLIENT
#options MSDOSFS #MSDOS Filesystem
options CD9660 #ISO 9660 Filesystem

View File

@ -51,6 +51,7 @@ options FFS #Berkeley Fast Filesystem
#options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\"
options NFSCLIENT #Network Filesystem Client
#options NFSSERVER #Network Filesystem Server
#options NFSLOCKD #Network Lock Manager
options NFS_ROOT #NFS usable as /, requires NFSCLIENT
options BOOTP_NFSROOT
options BOOTP

View File

@ -45,6 +45,7 @@ options UFS_ACL #Support for access control lists
options UFS_DIRHASH #Improve performance on big directories
options NFSCLIENT #Network Filesystem Client
options NFSSERVER #Network Filesystem Server
options NFSLOCKD #Network Lock Manager
options NFS_ROOT #NFS usable as /, requires NFSCLIENT
#options MSDOSFS #MSDOS Filesystem
options CD9660 #ISO 9660 Filesystem

View File

@ -42,6 +42,7 @@ options FFS #Berkeley Fast Filesystem
options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\"
options NFSCLIENT #Network Filesystem Client
#options NFSSERVER #Network Filesystem Server
#options NFSLOCKD #Network Lock Manager
#options NFS_ROOT #NFS usable as /, requires NFSCLIENT
#options BOOTP_NFSROOT
#options BOOTP

View File

@ -43,6 +43,7 @@ options MD_ROOT #MD is a potential root device
options ROOTDEVNAME=\"ufs:md0\"
options NFSCLIENT #Network Filesystem Client
options NFSSERVER #Network Filesystem Server
options NFSLOCKD #Network Lock Manager
options NFS_ROOT #NFS usable as /, requires NFSCLIENT
#options MSDOSFS #MSDOS Filesystem
options CD9660 #ISO 9660 Filesystem

View File

@ -46,6 +46,7 @@ options MD_ROOT_SIZE=4096
options ROOTDEVNAME=\"ufs:md0\"
options NFSCLIENT #Network Filesystem Client
options NFSSERVER #Network Filesystem Server
options NFSLOCKD #Network Lock Manager
options NFS_ROOT #NFS usable as /, requires NFSCLIENT
#options MSDOSFS #MSDOS Filesystem
options CD9660 #ISO 9660 Filesystem

View File

@ -41,6 +41,7 @@ options UFS_GJOURNAL # Enable gjournal-based UFS journaling
options MD_ROOT # MD is a potential root device
options NFSCLIENT # Network Filesystem Client
options NFSSERVER # Network Filesystem Server
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCLIENT
options MSDOSFS # MSDOS Filesystem
options CD9660 # ISO 9660 Filesystem

View File

@ -29,6 +29,7 @@ options SOFTUPDATES # Enable FFS soft updates support
#options MD_ROOT # MD is a potential root device
options NFSCLIENT # Network Filesystem Client
#options NFSSERVER # Network Filesystem Server
#options NFSLOCKD # Network Lock Manager
#options NFS_ROOT # NFS usable as /, requires NFSCLIENT
#options MSDOSFS # MSDOS Filesystem
options CD9660 # ISO 9660 Filesystem

View File

@ -44,6 +44,7 @@ options MD_ROOT # MD usable as root device
options MSDOSFS # MSDOS Filesystem
options NFSCLIENT # Network Filesystem Client
options NFSSERVER # Network Filesystem Server
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as root device
options PROCFS # Process filesystem (/proc)
options PSEUDOFS # Pseudo-filesystem framework

View File

@ -141,6 +141,7 @@ SUBDIR= ${_3dfx} \
${_ixgb} \
joy \
kbdmux \
krpc \
kue \
le \
lge \
@ -185,6 +186,7 @@ SUBDIR= ${_3dfx} \
netgraph \
${_nfe} \
nfsclient \
nfslockd \
nfsserver \
nge \
nmdm \

View File

@ -1781,3 +1781,23 @@ nlm_user_lockd(void)
return (nlm_lockd);
}
/*
* Kernel module glue
*/
static int
nfslockd_modevent(module_t mod, int type, void *data)
{
return (0);
}
static moduledata_t nfslockd_mod = {
"nfslockd",
nfslockd_modevent,
NULL,
};
DECLARE_MODULE(nfslockd, nfslockd_mod, SI_SUB_VFS, SI_ORDER_ANY);
/* So that loader and kldload(2) can find us, wherever we are.. */
MODULE_DEPEND(nfslockd, krpc, 1, 1, 1);
MODULE_VERSION(nfslockd, 1);

View File

@ -41,6 +41,7 @@ options UFS_GJOURNAL # Enable gjournal-based UFS journaling
options MD_ROOT # MD is a potential root device
options NFSCLIENT # Network Filesystem Client
options NFSSERVER # Network Filesystem Server
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCLIENT
options MSDOSFS # MSDOS Filesystem
options CD9660 # ISO 9660 Filesystem

View File

@ -42,6 +42,7 @@ options UFS_GJOURNAL #Enable gjournal-based UFS journaling
options MD_ROOT #MD is a potential root device
options NFSCLIENT #Network Filesystem Client
options NFSSERVER #Network Filesystem Server
options NFSLOCKD #Network Lock Manager
options NFS_ROOT #NFS usable as root device
options MSDOSFS #MSDOS Filesystem
options CD9660 #ISO 9660 Filesystem

View File

@ -44,7 +44,9 @@ __FBSDID("$FreeBSD$");
#include "opt_inet6.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/sbuf.h>
@ -714,3 +716,22 @@ __rpc_sockisbound(struct socket *so)
return bound;
}
/*
* Kernel module glue
*/
static int
krpc_modevent(module_t mod, int type, void *data)
{
return (0);
}
static moduledata_t krpc_mod = {
"krpc",
krpc_modevent,
NULL,
};
DECLARE_MODULE(krpc, krpc_mod, SI_SUB_VFS, SI_ORDER_ANY);
/* So that loader and kldload(2) can find us, wherever we are.. */
MODULE_VERSION(krpc, 1);

View File

@ -44,6 +44,7 @@ options UFS_GJOURNAL # Enable gjournal-based UFS journaling
options MD_ROOT # MD is a potential root device
options NFSCLIENT # Network Filesystem Client
options NFSSERVER # Network Filesystem Server
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCLIENT
#options MSDOSFS # MSDOS Filesystem
options CD9660 # ISO 9660 Filesystem

View File

@ -42,6 +42,7 @@ options UFS_GJOURNAL # Enable gjournal-based UFS journaling
options MD_ROOT # MD is a potential root device
options NFSCLIENT # Network Filesystem Client
options NFSSERVER # Network Filesystem Server
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCLIENT
#options MSDOSFS # MSDOS Filesystem
options NULLFS

View File

@ -46,7 +46,9 @@ __RCSID("$NetBSD: lockd.c,v 1.7 2000/08/12 18:08:44 thorpej Exp $");
* The actual program logic is in the file lock_proc.c
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/linker.h>
#include <sys/module.h>
#include <sys/socket.h>
#include <sys/stat.h>
@ -116,7 +118,7 @@ main(int argc, char **argv)
int maxrec = RPC_MAXDATASIZE;
in_port_t svcport = 0;
while ((ch = getopt(argc, argv, "d:g:h:kp:")) != (-1)) {
while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) {
switch (ch) {
case 'd':
debug_level = atoi(optarg);
@ -153,9 +155,6 @@ main(int argc, char **argv)
out_of_mem();
}
break;
case 'k':
kernel_lockd = TRUE;
break;
case 'p':
endptr = NULL;
svcport = (in_port_t)strtoul(optarg, &endptr, 10);
@ -175,6 +174,16 @@ main(int argc, char **argv)
exit(1);
}
kernel_lockd = FALSE;
if (modfind("nfslockd") < 0) {
if (kldload("nfslockd") < 0) {
fprintf(stderr, "Can't find or load kernel support for rpc.lockd - using non-kernel implementation\n");
}
kernel_lockd = TRUE;
} else {
kernel_lockd = TRUE;
}
(void)rpcb_unset(NLM_PROG, NLM_SM, NULL);
(void)rpcb_unset(NLM_PROG, NLM_VERS, NULL);
(void)rpcb_unset(NLM_PROG, NLM_VERSX, NULL);

View File

@ -41,7 +41,6 @@
.Nd NFS file locking daemon
.Sh SYNOPSIS
.Nm
.Op Fl k
.Op Fl d Ar debug_level
.Op Fl g Ar grace period
.Op Fl h Ar bindip
@ -59,11 +58,6 @@ with
Options and operands available for
.Nm :
.Bl -tag -width indent
.It Fl k
The
.Fl k
option specifies the use of the kernel-resident NFS lock manager, if
possible.
.It Fl d
The
.Fl d