Subject: Re: CVS commit: src/sys/nfs
To: None <yamt@netbsd.org>
From: Tom Spindler <dogcow@babymeat.com>
List: source-changes
Date: 05/18/2006 19:57:08
The changes to sys/nfs break when NFSSERVER is not defined, due to
the nfs server pool not existing and thus the cred allocations failing
to link in nqnfs_callback. The "easy" patch is to always alloc and
init nfs_srvdesc_pool, but I'm not positive this is TRT. yamt, could
you please comment? (building INSTALL_TINY is possibly the lowest-
effort way to see if things work when NFSSERVER ain't defined.)

The simple-minded patch to always init nfs_srvdesc_pool is below.

Index: nfs_socket.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_socket.c,v
retrieving revision 1.131
diff -u -w -p -r1.131 nfs_socket.c
--- nfs_socket.c	18 May 2006 12:44:45 -0000	1.131
+++ nfs_socket.c	19 May 2006 02:54:36 -0000
@@ -2573,7 +2573,9 @@ nfsrv_dorec(slp, nfsd, ndp)
 	nfsd->nfsd_nd = nd;
 	return (0);
 }
+#endif /* NFSSERVER */
 
+#ifndef NFS_v2_ONLY
 struct nfsrv_descript *
 nfsdreq_alloc(void)
 {
@@ -2596,7 +2598,9 @@ nfsdreq_free(struct nfsrv_descript *nd)
 	}
 	pool_put(&nfs_srvdesc_pool, nd);
 }
+#endif
 
+#ifdef NFSSERVER
 /*
  * Search for a sleeping nfsd and wake it up.
  * SIDE EFFECT: If none found, set NFSD_CHECKSLP flag, so that one of the
Index: nfs_subs.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_subs.c,v
retrieving revision 1.163
diff -u -w -p -r1.163 nfs_subs.c
--- nfs_subs.c	18 May 2006 12:44:45 -0000	1.163
+++ nfs_subs.c	19 May 2006 02:54:36 -0000
@@ -1562,14 +1562,14 @@ nfs_init0(void)
 #ifdef NFSSERVER
 	nfsrv_init(0);			/* Init server data structures */
 	nfsrv_initcache();		/* Init the server request cache */
-	pool_init(&nfs_srvdesc_pool, sizeof(struct nfsrv_descript),
-	    0, 0, 0, "nfsrvdescpl", &pool_allocator_nointr);
 #endif /* NFSSERVER */
 
 #if defined(NFSSERVER) || !defined(NFS_V2_ONLY)
 	/*
 	 * Initialize the nqnfs data structures.
 	 */
+	pool_init(&nfs_srvdesc_pool, sizeof(struct nfsrv_descript),
+	    0, 0, 0, "nfsrvdescpl", &pool_allocator_nointr);
 	if (nqnfsstarttime == 0) {
 		nqnfsstarttime = boottime.tv_sec + nqsrv_maxlease
 			+ nqsrv_clockskew + nqsrv_writeslack;
@@ -1578,6 +1578,7 @@ nfs_init0(void)
 		nqfhhashtbl = hashinit(NQLCHSZ, HASH_LIST, M_NQLEASE,
 		    M_WAITOK, &nqfhhash);
 	}
+
 #endif
 
 	exithook_establish(nfs_exit, NULL);
Index: nfs_syscalls.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_syscalls.c,v
retrieving revision 1.93
diff -u -w -p -r1.93 nfs_syscalls.c
--- nfs_syscalls.c	18 May 2006 12:44:45 -0000	1.93
+++ nfs_syscalls.c	19 May 2006 02:54:36 -0000
@@ -382,10 +382,11 @@ sys_nfssvc(l, v, retval)
 	return (error);
 }
 
+struct pool nfs_srvdesc_pool;
+
 #ifdef NFSSERVER
 MALLOC_DEFINE(M_NFSD, "NFS daemon", "Nfs server daemon structure");
 MALLOC_DEFINE(M_NFSSVC, "NFS srvsock", "Nfs server structure");
-struct pool nfs_srvdesc_pool;
 
 static struct nfssvc_sock *
 nfsrv_sockalloc()