1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1989, 1993
5 *	The Regents of the University of California.  All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Rick Macklem at The University of Guelph.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 *    may be used to endorse or promote products derived from this software
20 *    without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD$");
38
39#include "opt_inet6.h"
40#include "opt_kgssapi.h"
41#include "opt_kern_tls.h"
42
43#include <fs/nfs/nfsport.h>
44
45#include <rpc/rpc.h>
46#include <rpc/rpcsec_gss.h>
47#include <rpc/rpcsec_tls.h>
48
49#include <fs/nfsserver/nfs_fha_new.h>
50
51#include <security/mac/mac_framework.h>
52
53NFSDLOCKMUTEX;
54NFSV4ROOTLOCKMUTEX;
55struct nfsv4lock nfsd_suspend_lock;
56char *nfsrv_zeropnfsdat = NULL;
57
58/*
59 * Mapping of old NFS Version 2 RPC numbers to generic numbers.
60 */
61int newnfs_nfsv3_procid[NFS_V3NPROCS] = {
62	NFSPROC_NULL,
63	NFSPROC_GETATTR,
64	NFSPROC_SETATTR,
65	NFSPROC_NOOP,
66	NFSPROC_LOOKUP,
67	NFSPROC_READLINK,
68	NFSPROC_READ,
69	NFSPROC_NOOP,
70	NFSPROC_WRITE,
71	NFSPROC_CREATE,
72	NFSPROC_REMOVE,
73	NFSPROC_RENAME,
74	NFSPROC_LINK,
75	NFSPROC_SYMLINK,
76	NFSPROC_MKDIR,
77	NFSPROC_RMDIR,
78	NFSPROC_READDIR,
79	NFSPROC_FSSTAT,
80	NFSPROC_NOOP,
81	NFSPROC_NOOP,
82	NFSPROC_NOOP,
83	NFSPROC_NOOP,
84};
85
86SYSCTL_DECL(_vfs_nfsd);
87
88SVCPOOL		*nfsrvd_pool;
89
90static int	nfs_privport = 0;
91SYSCTL_INT(_vfs_nfsd, OID_AUTO, nfs_privport, CTLFLAG_RWTUN,
92    &nfs_privport, 0,
93    "Only allow clients using a privileged port for NFSv2, 3 and 4");
94
95static int	nfs_minvers = NFS_VER2;
96SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_min_nfsvers, CTLFLAG_RWTUN,
97    &nfs_minvers, 0, "The lowest version of NFS handled by the server");
98
99static int	nfs_maxvers = NFS_VER4;
100SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_nfsvers, CTLFLAG_RWTUN,
101    &nfs_maxvers, 0, "The highest version of NFS handled by the server");
102
103static int nfs_proc(struct nfsrv_descript *, u_int32_t, SVCXPRT *xprt,
104    struct nfsrvcache **);
105
106extern u_long sb_max_adj;
107extern int newnfs_numnfsd;
108extern struct proc *nfsd_master_proc;
109extern time_t nfsdev_time;
110extern int nfsrv_writerpc[NFS_NPROCS];
111extern volatile int nfsrv_devidcnt;
112extern struct nfsv4_opflag nfsv4_opflag[NFSV42_NOPS];
113
114/*
115 * NFS server system calls
116 */
117
118static void
119nfssvc_program(struct svc_req *rqst, SVCXPRT *xprt)
120{
121	struct nfsrv_descript nd;
122	struct nfsrvcache *rp = NULL;
123	int cacherep, credflavor;
124#ifdef KERN_TLS
125	u_int maxlen;
126#endif
127
128	memset(&nd, 0, sizeof(nd));
129	if (rqst->rq_vers == NFS_VER2) {
130		if (rqst->rq_proc > NFSV2PROC_STATFS ||
131		    newnfs_nfsv3_procid[rqst->rq_proc] == NFSPROC_NOOP) {
132			svcerr_noproc(rqst);
133			svc_freereq(rqst);
134			goto out;
135		}
136		nd.nd_procnum = newnfs_nfsv3_procid[rqst->rq_proc];
137		nd.nd_flag = ND_NFSV2;
138	} else if (rqst->rq_vers == NFS_VER3) {
139		if (rqst->rq_proc >= NFS_V3NPROCS) {
140			svcerr_noproc(rqst);
141			svc_freereq(rqst);
142			goto out;
143		}
144		nd.nd_procnum = rqst->rq_proc;
145		nd.nd_flag = ND_NFSV3;
146	} else {
147		if (rqst->rq_proc != NFSPROC_NULL &&
148		    rqst->rq_proc != NFSV4PROC_COMPOUND) {
149			svcerr_noproc(rqst);
150			svc_freereq(rqst);
151			goto out;
152		}
153		nd.nd_procnum = rqst->rq_proc;
154		nd.nd_flag = ND_NFSV4;
155	}
156
157	/*
158	 * Note: we want rq_addr, not svc_getrpccaller for nd_nam2 -
159	 * NFS_SRVMAXDATA uses a NULL value for nd_nam2 to detect TCP
160	 * mounts.
161	 */
162	nd.nd_mrep = rqst->rq_args;
163	rqst->rq_args = NULL;
164	newnfs_realign(&nd.nd_mrep, M_WAITOK);
165	nd.nd_md = nd.nd_mrep;
166	nd.nd_dpos = mtod(nd.nd_md, caddr_t);
167	nd.nd_nam = svc_getrpccaller(rqst);
168	nd.nd_nam2 = rqst->rq_addr;
169	nd.nd_mreq = NULL;
170	nd.nd_cred = NULL;
171
172	if (nfs_privport != 0) {
173		/* Check if source port is privileged */
174		u_short port;
175		struct sockaddr *nam = nd.nd_nam;
176		struct sockaddr_in *sin;
177
178		sin = (struct sockaddr_in *)nam;
179		/*
180		 * INET/INET6 - same code:
181		 *    sin_port and sin6_port are at same offset
182		 */
183		port = ntohs(sin->sin_port);
184		if (port >= IPPORT_RESERVED &&
185		    nd.nd_procnum != NFSPROC_NULL) {
186#ifdef INET6
187			char buf[INET6_ADDRSTRLEN];
188#else
189			char buf[INET_ADDRSTRLEN];
190#endif
191#ifdef INET6
192#if defined(KLD_MODULE)
193			/* Do not use ip6_sprintf: the nfs module should work without INET6. */
194#define	ip6_sprintf(buf, a)						\
195			(sprintf((buf), "%x:%x:%x:%x:%x:%x:%x:%x",	\
196			    (a)->s6_addr16[0], (a)->s6_addr16[1],	\
197			    (a)->s6_addr16[2], (a)->s6_addr16[3],	\
198			    (a)->s6_addr16[4], (a)->s6_addr16[5],	\
199			    (a)->s6_addr16[6], (a)->s6_addr16[7]),	\
200			    (buf))
201#endif
202#endif
203			printf("NFS request from unprivileged port (%s:%d)\n",
204#ifdef INET6
205			    sin->sin_family == AF_INET6 ?
206			    ip6_sprintf(buf, &satosin6(sin)->sin6_addr) :
207#if defined(KLD_MODULE)
208#undef ip6_sprintf
209#endif
210#endif
211			    inet_ntoa_r(sin->sin_addr, buf), port);
212			svcerr_weakauth(rqst);
213			svc_freereq(rqst);
214			m_freem(nd.nd_mrep);
215			goto out;
216		}
217	}
218
219	if (nd.nd_procnum != NFSPROC_NULL) {
220		if (!svc_getcred(rqst, &nd.nd_cred, &credflavor)) {
221			svcerr_weakauth(rqst);
222			svc_freereq(rqst);
223			m_freem(nd.nd_mrep);
224			goto out;
225		}
226
227		/* Set the flag based on credflavor */
228		if (credflavor == RPCSEC_GSS_KRB5) {
229			nd.nd_flag |= ND_GSS;
230		} else if (credflavor == RPCSEC_GSS_KRB5I) {
231			nd.nd_flag |= (ND_GSS | ND_GSSINTEGRITY);
232		} else if (credflavor == RPCSEC_GSS_KRB5P) {
233			nd.nd_flag |= (ND_GSS | ND_GSSPRIVACY);
234		} else if (credflavor != AUTH_SYS) {
235			svcerr_weakauth(rqst);
236			svc_freereq(rqst);
237			m_freem(nd.nd_mrep);
238			goto out;
239		}
240
241		if ((xprt->xp_tls & RPCTLS_FLAGS_HANDSHAKE) != 0) {
242			nd.nd_flag |= ND_TLS;
243			if ((xprt->xp_tls & RPCTLS_FLAGS_VERIFIED) != 0)
244				nd.nd_flag |= ND_TLSCERT;
245			if ((xprt->xp_tls & RPCTLS_FLAGS_CERTUSER) != 0)
246				nd.nd_flag |= ND_TLSCERTUSER;
247		}
248		nd.nd_maxextsiz = 16384;
249#ifdef MAC
250		mac_cred_associate_nfsd(nd.nd_cred);
251#endif
252		/*
253		 * Get a refcnt (shared lock) on nfsd_suspend_lock.
254		 * NFSSVC_SUSPENDNFSD will take an exclusive lock on
255		 * nfsd_suspend_lock to suspend these threads.
256		 * The call to nfsv4_lock() that precedes nfsv4_getref()
257		 * ensures that the acquisition of the exclusive lock
258		 * takes priority over acquisition of the shared lock by
259		 * waiting for any exclusive lock request to complete.
260		 * This must be done here, before the check of
261		 * nfsv4root exports by nfsvno_v4rootexport().
262		 */
263		NFSLOCKV4ROOTMUTEX();
264		nfsv4_lock(&nfsd_suspend_lock, 0, NULL, NFSV4ROOTLOCKMUTEXPTR,
265		    NULL);
266		nfsv4_getref(&nfsd_suspend_lock, NULL, NFSV4ROOTLOCKMUTEXPTR,
267		    NULL);
268		NFSUNLOCKV4ROOTMUTEX();
269
270		if ((nd.nd_flag & ND_NFSV4) != 0) {
271			nd.nd_repstat = nfsvno_v4rootexport(&nd);
272			if (nd.nd_repstat != 0) {
273				NFSLOCKV4ROOTMUTEX();
274				nfsv4_relref(&nfsd_suspend_lock);
275				NFSUNLOCKV4ROOTMUTEX();
276				svcerr_weakauth(rqst);
277				svc_freereq(rqst);
278				m_freem(nd.nd_mrep);
279				goto out;
280			}
281		}
282
283#ifdef KERN_TLS
284		if ((xprt->xp_tls & RPCTLS_FLAGS_HANDSHAKE) != 0 &&
285		    rpctls_getinfo(&maxlen, false, false))
286			nd.nd_maxextsiz = maxlen;
287#endif
288		cacherep = nfs_proc(&nd, rqst->rq_xid, xprt, &rp);
289		NFSLOCKV4ROOTMUTEX();
290		nfsv4_relref(&nfsd_suspend_lock);
291		NFSUNLOCKV4ROOTMUTEX();
292	} else {
293		NFSMGET(nd.nd_mreq);
294		nd.nd_mreq->m_len = 0;
295		cacherep = RC_REPLY;
296	}
297	if (nd.nd_mrep != NULL)
298		m_freem(nd.nd_mrep);
299
300	if (nd.nd_cred != NULL)
301		crfree(nd.nd_cred);
302
303	if (cacherep == RC_DROPIT) {
304		if (nd.nd_mreq != NULL)
305			m_freem(nd.nd_mreq);
306		svc_freereq(rqst);
307		goto out;
308	}
309
310	if (nd.nd_mreq == NULL) {
311		svcerr_decode(rqst);
312		svc_freereq(rqst);
313		goto out;
314	}
315
316	if (nd.nd_repstat & NFSERR_AUTHERR) {
317		svcerr_auth(rqst, nd.nd_repstat & ~NFSERR_AUTHERR);
318		if (nd.nd_mreq != NULL)
319			m_freem(nd.nd_mreq);
320	} else if (!svc_sendreply_mbuf(rqst, nd.nd_mreq)) {
321		svcerr_systemerr(rqst);
322	}
323	if (rp != NULL) {
324		nfsrvd_sentcache(rp, (rqst->rq_reply_seq != 0 ||
325		    SVC_ACK(xprt, NULL)), rqst->rq_reply_seq);
326	}
327	svc_freereq(rqst);
328
329out:
330	td_softdep_cleanup(curthread);
331	NFSEXITCODE(0);
332}
333
334/*
335 * Check the cache and, optionally, do the RPC.
336 * Return the appropriate cache response.
337 */
338static int
339nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, SVCXPRT *xprt,
340    struct nfsrvcache **rpp)
341{
342	int cacherep = RC_DOIT, isdgram, taglen = -1;
343	struct mbuf *m;
344	u_char tag[NFSV4_SMALLSTR + 1], *tagstr = NULL;
345	u_int32_t minorvers = 0;
346	uint32_t ack;
347
348	*rpp = NULL;
349	if (nd->nd_nam2 == NULL) {
350		nd->nd_flag |= ND_STREAMSOCK;
351		isdgram = 0;
352	} else {
353		isdgram = 1;
354	}
355
356	/*
357	 * Two cases:
358	 * 1 - For NFSv2 over UDP, if we are near our malloc/mget
359	 *     limit, just drop the request. There is no
360	 *     NFSERR_RESOURCE or NFSERR_DELAY for NFSv2 and the
361	 *     client will timeout/retry over UDP in a little while.
362	 * 2 - nd_repstat == 0 && nd_mreq == NULL, which
363	 *     means a normal nfs rpc, so check the cache
364	 */
365	if ((nd->nd_flag & ND_NFSV2) && nd->nd_nam2 != NULL &&
366	    nfsrv_mallocmget_limit()) {
367		cacherep = RC_DROPIT;
368	} else {
369		/*
370		 * For NFSv3, play it safe and assume that the client is
371		 * doing retries on the same TCP connection.
372		 */
373		if ((nd->nd_flag & (ND_NFSV4 | ND_STREAMSOCK)) ==
374		    ND_STREAMSOCK)
375			nd->nd_flag |= ND_SAMETCPCONN;
376		nd->nd_retxid = xid;
377		nd->nd_tcpconntime = NFSD_MONOSEC;
378		nd->nd_sockref = xprt->xp_sockref;
379		if ((nd->nd_flag & ND_NFSV4) != 0)
380			nfsd_getminorvers(nd, tag, &tagstr, &taglen,
381			    &minorvers);
382		if ((nd->nd_flag & ND_NFSV41) != 0)
383			/* NFSv4.1 caches replies in the session slots. */
384			cacherep = RC_DOIT;
385		else {
386			cacherep = nfsrvd_getcache(nd);
387			ack = 0;
388			SVC_ACK(xprt, &ack);
389			nfsrc_trimcache(xprt->xp_sockref, ack, 0);
390		}
391	}
392
393	/*
394	 * Handle the request. There are three cases.
395	 * RC_DOIT - do the RPC
396	 * RC_REPLY - return the reply already created
397	 * RC_DROPIT - just throw the request away
398	 */
399	if (cacherep == RC_DOIT) {
400		if ((nd->nd_flag & ND_NFSV41) != 0)
401			nd->nd_xprt = xprt;
402		nfsrvd_dorpc(nd, isdgram, tagstr, taglen, minorvers);
403		if ((nd->nd_flag & ND_NFSV41) != 0) {
404			if (nd->nd_repstat != NFSERR_REPLYFROMCACHE &&
405			    (nd->nd_flag & ND_SAVEREPLY) != 0) {
406				/* Cache a copy of the reply. */
407				m = m_copym(nd->nd_mreq, 0, M_COPYALL,
408				    M_WAITOK);
409			} else
410				m = NULL;
411			if ((nd->nd_flag & ND_HASSEQUENCE) != 0)
412				nfsrv_cache_session(nd, &m);
413			if (nd->nd_repstat == NFSERR_REPLYFROMCACHE) {
414				nd->nd_repstat = 0;
415				if (m != NULL) {
416					m_freem(nd->nd_mreq);
417					nd->nd_mreq = m;
418				}
419			}
420			cacherep = RC_REPLY;
421		} else {
422			if (nd->nd_repstat == NFSERR_DONTREPLY)
423				cacherep = RC_DROPIT;
424			else
425				cacherep = RC_REPLY;
426			*rpp = nfsrvd_updatecache(nd);
427		}
428	}
429	if (tagstr != NULL && taglen > NFSV4_SMALLSTR)
430		free(tagstr, M_TEMP);
431
432	NFSEXITCODE2(0, nd);
433	return (cacherep);
434}
435
436static void
437nfssvc_loss(SVCXPRT *xprt)
438{
439	uint32_t ack;
440
441	ack = 0;
442	SVC_ACK(xprt, &ack);
443	nfsrc_trimcache(xprt->xp_sockref, ack, 1);
444}
445
446/*
447 * Adds a socket to the list for servicing by nfsds.
448 */
449int
450nfsrvd_addsock(struct file *fp)
451{
452	int siz;
453	struct socket *so;
454	int error = 0;
455	SVCXPRT *xprt;
456	static u_int64_t sockref = 0;
457
458	so = fp->f_data;
459
460	siz = sb_max_adj;
461	error = soreserve(so, siz, siz);
462	if (error)
463		goto out;
464
465	/*
466	 * Steal the socket from userland so that it doesn't close
467	 * unexpectedly.
468	 */
469	if (so->so_type == SOCK_DGRAM)
470		xprt = svc_dg_create(nfsrvd_pool, so, 0, 0);
471	else
472		xprt = svc_vc_create(nfsrvd_pool, so, 0, 0);
473	if (xprt) {
474		fp->f_ops = &badfileops;
475		fp->f_data = NULL;
476		xprt->xp_sockref = ++sockref;
477		if (nfs_minvers == NFS_VER2)
478			svc_reg(xprt, NFS_PROG, NFS_VER2, nfssvc_program,
479			    NULL);
480		if (nfs_minvers <= NFS_VER3 && nfs_maxvers >= NFS_VER3)
481			svc_reg(xprt, NFS_PROG, NFS_VER3, nfssvc_program,
482			    NULL);
483		if (nfs_maxvers >= NFS_VER4)
484			svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program,
485			    NULL);
486		if (so->so_type == SOCK_STREAM)
487			svc_loss_reg(xprt, nfssvc_loss);
488		SVC_RELEASE(xprt);
489	}
490
491out:
492	NFSEXITCODE(error);
493	return (error);
494}
495
496/*
497 * Called by nfssvc() for nfsds. Just loops around servicing rpc requests
498 * until it is killed by a signal.
499 */
500int
501nfsrvd_nfsd(struct thread *td, struct nfsd_nfsd_args *args)
502{
503	char principal[MAXHOSTNAMELEN + 5];
504	struct proc *p;
505	int error = 0;
506	bool_t ret2, ret3, ret4;
507
508	error = copyinstr(args->principal, principal, sizeof (principal),
509	    NULL);
510	if (error)
511		goto out;
512
513	/*
514	 * Only the first nfsd actually does any work. The RPC code
515	 * adds threads to it as needed. Any extra processes offered
516	 * by nfsd just exit. If nfsd is new enough, it will call us
517	 * once with a structure that specifies how many threads to
518	 * use.
519	 */
520	NFSD_LOCK();
521	if (newnfs_numnfsd == 0) {
522		nfsdev_time = time_second;
523		p = td->td_proc;
524		PROC_LOCK(p);
525		p->p_flag2 |= P2_AST_SU;
526		PROC_UNLOCK(p);
527		newnfs_numnfsd++;
528
529		NFSD_UNLOCK();
530		error = nfsrv_createdevids(args, td);
531		if (error == 0) {
532			/* An empty string implies AUTH_SYS only. */
533			if (principal[0] != '\0') {
534				ret2 = rpc_gss_set_svc_name_call(principal,
535				    "kerberosv5", GSS_C_INDEFINITE, NFS_PROG,
536				    NFS_VER2);
537				ret3 = rpc_gss_set_svc_name_call(principal,
538				    "kerberosv5", GSS_C_INDEFINITE, NFS_PROG,
539				    NFS_VER3);
540				ret4 = rpc_gss_set_svc_name_call(principal,
541				    "kerberosv5", GSS_C_INDEFINITE, NFS_PROG,
542				    NFS_VER4);
543
544				if (!ret2 || !ret3 || !ret4)
545					printf(
546					    "nfsd: can't register svc name\n");
547			}
548
549			nfsrvd_pool->sp_minthreads = args->minthreads;
550			nfsrvd_pool->sp_maxthreads = args->maxthreads;
551
552			/*
553			 * If this is a pNFS service, make Getattr do a
554			 * vn_start_write(), so it can do a vn_set_extattr().
555			 */
556			if (nfsrv_devidcnt > 0) {
557				nfsrv_writerpc[NFSPROC_GETATTR] = 1;
558				nfsv4_opflag[NFSV4OP_GETATTR].modifyfs = 1;
559			}
560
561			svc_run(nfsrvd_pool);
562
563			/* Reset Getattr to not do a vn_start_write(). */
564			nfsrv_writerpc[NFSPROC_GETATTR] = 0;
565			nfsv4_opflag[NFSV4OP_GETATTR].modifyfs = 0;
566
567			if (principal[0] != '\0') {
568				rpc_gss_clear_svc_name_call(NFS_PROG, NFS_VER2);
569				rpc_gss_clear_svc_name_call(NFS_PROG, NFS_VER3);
570				rpc_gss_clear_svc_name_call(NFS_PROG, NFS_VER4);
571			}
572		}
573		NFSD_LOCK();
574		newnfs_numnfsd--;
575		nfsrvd_init(1);
576		PROC_LOCK(p);
577		p->p_flag2 &= ~P2_AST_SU;
578		PROC_UNLOCK(p);
579	}
580	NFSD_UNLOCK();
581
582out:
583	NFSEXITCODE(error);
584	return (error);
585}
586
587/*
588 * Initialize the data structures for the server.
589 * Handshake with any new nfsds starting up to avoid any chance of
590 * corruption.
591 */
592void
593nfsrvd_init(int terminating)
594{
595
596	NFSD_LOCK_ASSERT();
597
598	if (terminating) {
599		nfsd_master_proc = NULL;
600		NFSD_UNLOCK();
601		nfsrv_freealllayoutsanddevids();
602		nfsrv_freeallbackchannel_xprts();
603		svcpool_close(nfsrvd_pool);
604		free(nfsrv_zeropnfsdat, M_TEMP);
605		nfsrv_zeropnfsdat = NULL;
606		NFSD_LOCK();
607	} else {
608		NFSD_UNLOCK();
609		nfsrvd_pool = svcpool_create("nfsd",
610		    SYSCTL_STATIC_CHILDREN(_vfs_nfsd));
611		nfsrvd_pool->sp_rcache = NULL;
612		nfsrvd_pool->sp_assign = fhanew_assign;
613		nfsrvd_pool->sp_done = fhanew_nd_complete;
614		NFSD_LOCK();
615	}
616}
617