1994-05-24 10:09:53 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1989, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Rick Macklem at The University of Guelph.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1997-02-10 02:22:35 +00:00
|
|
|
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
|
1994-05-24 10:09:53 +00:00
|
|
|
*/
|
|
|
|
|
2001-09-18 23:32:09 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2002-07-15 19:40:23 +00:00
|
|
|
#include "opt_inet6.h"
|
2002-11-04 15:13:36 +00:00
|
|
|
#include "opt_mac.h"
|
2002-07-15 19:40:23 +00:00
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
1995-11-14 05:16:37 +00:00
|
|
|
#include <sys/sysproto.h>
|
1994-05-24 10:09:53 +00:00
|
|
|
#include <sys/kernel.h>
|
1996-11-06 10:53:16 +00:00
|
|
|
#include <sys/sysctl.h>
|
1994-05-24 10:09:53 +00:00
|
|
|
#include <sys/file.h>
|
1996-04-30 23:26:52 +00:00
|
|
|
#include <sys/filedesc.h>
|
1994-05-24 10:09:53 +00:00
|
|
|
#include <sys/vnode.h>
|
2002-11-04 15:13:36 +00:00
|
|
|
#include <sys/mac.h>
|
1997-10-12 20:26:33 +00:00
|
|
|
#include <sys/malloc.h>
|
1994-05-24 10:09:53 +00:00
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/proc.h>
|
2000-05-05 09:59:14 +00:00
|
|
|
#include <sys/bio.h>
|
1994-05-24 10:09:53 +00:00
|
|
|
#include <sys/buf.h>
|
|
|
|
#include <sys/mbuf.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/socketvar.h>
|
|
|
|
#include <sys/domain.h>
|
|
|
|
#include <sys/protosw.h>
|
|
|
|
#include <sys/namei.h>
|
2001-04-17 20:45:23 +00:00
|
|
|
#include <sys/fcntl.h>
|
|
|
|
#include <sys/lockf.h>
|
1994-05-24 10:09:53 +00:00
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/tcp.h>
|
2002-07-15 19:40:23 +00:00
|
|
|
#ifdef INET6
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <netinet6/in6_var.h>
|
|
|
|
#endif
|
1995-06-27 11:07:30 +00:00
|
|
|
#include <nfs/xdr_subs.h>
|
1994-05-24 10:09:53 +00:00
|
|
|
#include <nfs/rpcv2.h>
|
1995-06-27 11:07:30 +00:00
|
|
|
#include <nfs/nfsproto.h>
|
2001-09-18 23:32:09 +00:00
|
|
|
#include <nfsserver/nfs.h>
|
|
|
|
#include <nfsserver/nfsm_subs.h>
|
|
|
|
#include <nfsserver/nfsrvcache.h>
|
1994-05-24 10:09:53 +00:00
|
|
|
|
1997-10-12 20:26:33 +00:00
|
|
|
static MALLOC_DEFINE(M_NFSSVC, "NFS srvsock", "Nfs server structure");
|
1997-10-11 18:31:40 +00:00
|
|
|
|
2001-09-18 23:32:09 +00:00
|
|
|
MALLOC_DEFINE(M_NFSRVDESC, "NFSV3 srvdesc", "NFS server socket descriptor");
|
|
|
|
MALLOC_DEFINE(M_NFSD, "NFS daemon", "Nfs server daemon structure");
|
1995-11-21 15:51:39 +00:00
|
|
|
|
2001-09-18 23:32:09 +00:00
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
#define TRUE 1
|
|
|
|
#define FALSE 0
|
|
|
|
|
2001-09-18 23:32:09 +00:00
|
|
|
SYSCTL_DECL(_vfs_nfsrv);
|
1995-11-21 15:51:39 +00:00
|
|
|
|
2001-09-18 23:32:09 +00:00
|
|
|
int nfsd_waiting = 0;
|
|
|
|
static int nfs_numnfsd = 0;
|
|
|
|
static int notstarted = 1;
|
1999-02-18 09:19:41 +00:00
|
|
|
|
2001-09-18 23:32:09 +00:00
|
|
|
static int nfs_privport = 0;
|
|
|
|
SYSCTL_INT(_vfs_nfsrv, NFS_NFSPRIVPORT, nfs_privport, CTLFLAG_RW,
|
|
|
|
&nfs_privport, 0, "");
|
|
|
|
SYSCTL_INT(_vfs_nfsrv, OID_AUTO, gatherdelay, CTLFLAG_RW,
|
|
|
|
&nfsrvw_procrastinate, 0, "");
|
|
|
|
SYSCTL_INT(_vfs_nfsrv, OID_AUTO, gatherdelay_v3, CTLFLAG_RW,
|
|
|
|
&nfsrvw_procrastinate_v3, 0, "");
|
1997-03-27 20:01:07 +00:00
|
|
|
|
2001-09-18 23:32:09 +00:00
|
|
|
static int nfssvc_addsock(struct file *, struct sockaddr *,
|
|
|
|
struct thread *);
|
|
|
|
static void nfsrv_zapsock(struct nfssvc_sock *slp);
|
2002-07-24 23:10:34 +00:00
|
|
|
static int nfssvc_nfsd(struct thread *);
|
1997-03-27 20:01:07 +00:00
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
/*
|
|
|
|
* NFS server system calls
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Nfs server psuedo system call for the nfsd's
|
|
|
|
* Based on the flag value it either:
|
|
|
|
* - adds a socket to the selection list
|
|
|
|
* - remains in the kernel as an nfsd
|
|
|
|
* - remains in the kernel as an nfsiod
|
2002-07-22 15:55:50 +00:00
|
|
|
* For INET6 we suppose that nfsd provides only IN6P_IPV6_V6ONLY sockets
|
2002-07-15 19:40:23 +00:00
|
|
|
* and that mountd provides
|
|
|
|
* - sockaddr with no IPv4-mapped addresses
|
|
|
|
* - mask for both INET and INET6 families if there is IPv4-mapped overlap
|
1994-05-24 10:09:53 +00:00
|
|
|
*/
|
1995-11-14 05:16:37 +00:00
|
|
|
#ifndef _SYS_SYSPROTO_H_
|
1994-05-24 10:09:53 +00:00
|
|
|
struct nfssvc_args {
|
|
|
|
int flag;
|
|
|
|
caddr_t argp;
|
|
|
|
};
|
1995-11-14 05:16:37 +00:00
|
|
|
#endif
|
2001-08-31 22:39:36 +00:00
|
|
|
/*
|
|
|
|
* MPSAFE
|
|
|
|
*/
|
1994-05-25 09:21:21 +00:00
|
|
|
int
|
2001-09-18 23:32:09 +00:00
|
|
|
nfssvc(struct thread *td, struct nfssvc_args *uap)
|
1994-05-24 10:09:53 +00:00
|
|
|
{
|
|
|
|
struct file *fp;
|
1997-08-16 19:16:27 +00:00
|
|
|
struct sockaddr *nam;
|
1994-05-24 10:09:53 +00:00
|
|
|
struct nfsd_args nfsdarg;
|
|
|
|
int error;
|
|
|
|
|
2002-11-04 15:13:36 +00:00
|
|
|
#ifdef MAC
|
|
|
|
error = mac_check_system_nfsd(td->td_ucred);
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
#endif
|
2002-04-01 21:31:13 +00:00
|
|
|
error = suser(td);
|
2001-08-31 22:39:36 +00:00
|
|
|
if (error)
|
2002-11-04 15:13:36 +00:00
|
|
|
return (error);
|
|
|
|
mtx_lock(&Giant);
|
1994-10-17 17:47:45 +00:00
|
|
|
while (nfssvc_sockhead_flag & SLP_INIT) {
|
|
|
|
nfssvc_sockhead_flag |= SLP_WANTINIT;
|
2003-03-02 16:54:40 +00:00
|
|
|
(void) tsleep(&nfssvc_sockhead, PSOCK, "nfsd init", 0);
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
2001-09-18 23:32:09 +00:00
|
|
|
if (uap->flag & NFSSVC_ADDSOCK) {
|
1994-10-02 17:27:07 +00:00
|
|
|
error = copyin(uap->argp, (caddr_t)&nfsdarg, sizeof(nfsdarg));
|
|
|
|
if (error)
|
2001-08-31 22:39:36 +00:00
|
|
|
goto done2;
|
2001-11-17 03:07:11 +00:00
|
|
|
if ((error = fget(td, nfsdarg.sock, &fp)) != 0)
|
|
|
|
goto done2;
|
|
|
|
if (fp->f_type != DTYPE_SOCKET) {
|
|
|
|
fdrop(fp, td);
|
2001-08-31 22:39:36 +00:00
|
|
|
goto done2;
|
2001-11-17 03:07:11 +00:00
|
|
|
}
|
1994-05-24 10:09:53 +00:00
|
|
|
/*
|
|
|
|
* Get the client address for connected sockets.
|
|
|
|
*/
|
|
|
|
if (nfsdarg.name == NULL || nfsdarg.namelen == 0)
|
2002-07-11 17:54:58 +00:00
|
|
|
nam = NULL;
|
1994-10-02 17:27:07 +00:00
|
|
|
else {
|
1997-08-16 19:16:27 +00:00
|
|
|
error = getsockaddr(&nam, nfsdarg.name,
|
|
|
|
nfsdarg.namelen);
|
2000-11-18 21:01:04 +00:00
|
|
|
if (error) {
|
2001-09-12 08:38:13 +00:00
|
|
|
fdrop(fp, td);
|
2001-08-31 22:39:36 +00:00
|
|
|
goto done2;
|
2000-11-18 21:01:04 +00:00
|
|
|
}
|
1994-10-02 17:27:07 +00:00
|
|
|
}
|
2001-09-12 08:38:13 +00:00
|
|
|
error = nfssvc_addsock(fp, nam, td);
|
|
|
|
fdrop(fp, td);
|
2001-09-18 23:32:09 +00:00
|
|
|
} else if (uap->flag & NFSSVC_NFSD) {
|
2002-07-24 23:10:34 +00:00
|
|
|
error = nfssvc_nfsd(td);
|
2001-09-18 23:32:09 +00:00
|
|
|
} else {
|
|
|
|
error = ENXIO;
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
|
|
|
if (error == EINTR || error == ERESTART)
|
|
|
|
error = 0;
|
2001-08-31 22:39:36 +00:00
|
|
|
done2:
|
|
|
|
mtx_unlock(&Giant);
|
1994-05-24 10:09:53 +00:00
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Adds a socket to the list for servicing by nfsds.
|
|
|
|
*/
|
1995-12-17 21:14:36 +00:00
|
|
|
static int
|
2001-09-18 23:32:09 +00:00
|
|
|
nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td)
|
1994-05-24 10:09:53 +00:00
|
|
|
{
|
2001-09-18 23:32:09 +00:00
|
|
|
int siz;
|
|
|
|
struct nfssvc_sock *slp;
|
|
|
|
struct socket *so;
|
1994-05-24 10:09:53 +00:00
|
|
|
int error, s;
|
|
|
|
|
2003-11-07 22:57:09 +00:00
|
|
|
GIANT_REQUIRED; /* XXX until socket locking done */
|
|
|
|
|
2003-01-13 00:33:17 +00:00
|
|
|
so = fp->f_data;
|
1999-11-11 17:24:02 +00:00
|
|
|
#if 0
|
2002-07-11 17:54:58 +00:00
|
|
|
tslp = NULL;
|
1994-05-24 10:09:53 +00:00
|
|
|
/*
|
|
|
|
* Add it to the list, as required.
|
|
|
|
*/
|
|
|
|
if (so->so_proto->pr_protocol == IPPROTO_UDP) {
|
|
|
|
tslp = nfs_udpsock;
|
|
|
|
if (tslp->ns_flag & SLP_VALID) {
|
1999-11-08 19:10:16 +00:00
|
|
|
if (mynam != NULL)
|
|
|
|
FREE(mynam, M_SONAME);
|
1994-05-24 10:09:53 +00:00
|
|
|
return (EPERM);
|
|
|
|
}
|
|
|
|
}
|
1999-11-11 17:24:02 +00:00
|
|
|
#endif
|
1994-05-24 10:09:53 +00:00
|
|
|
if (so->so_type == SOCK_STREAM)
|
|
|
|
siz = NFS_MAXPACKET + sizeof (u_long);
|
|
|
|
else
|
|
|
|
siz = NFS_MAXPACKET;
|
1995-05-30 08:16:23 +00:00
|
|
|
error = soreserve(so, siz, siz);
|
1994-10-02 17:27:07 +00:00
|
|
|
if (error) {
|
1999-11-08 19:10:16 +00:00
|
|
|
if (mynam != NULL)
|
|
|
|
FREE(mynam, M_SONAME);
|
1994-05-24 10:09:53 +00:00
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set protocol specific options { for now TCP only } and
|
|
|
|
* reserve some space. For datagram sockets, this can get called
|
|
|
|
* repeatedly for the same socket, but that isn't harmful.
|
|
|
|
*/
|
|
|
|
if (so->so_type == SOCK_STREAM) {
|
1998-08-23 03:07:17 +00:00
|
|
|
struct sockopt sopt;
|
|
|
|
int val;
|
|
|
|
|
|
|
|
bzero(&sopt, sizeof sopt);
|
2003-10-04 17:37:51 +00:00
|
|
|
sopt.sopt_dir = SOPT_SET;
|
1998-08-23 03:07:17 +00:00
|
|
|
sopt.sopt_level = SOL_SOCKET;
|
|
|
|
sopt.sopt_name = SO_KEEPALIVE;
|
|
|
|
sopt.sopt_val = &val;
|
|
|
|
sopt.sopt_valsize = sizeof val;
|
|
|
|
val = 1;
|
|
|
|
sosetopt(so, &sopt);
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
2002-07-15 19:40:23 +00:00
|
|
|
if (so->so_proto->pr_protocol == IPPROTO_TCP) {
|
1998-08-23 03:07:17 +00:00
|
|
|
struct sockopt sopt;
|
|
|
|
int val;
|
|
|
|
|
|
|
|
bzero(&sopt, sizeof sopt);
|
2003-10-04 17:37:51 +00:00
|
|
|
sopt.sopt_dir = SOPT_SET;
|
1998-08-23 03:07:17 +00:00
|
|
|
sopt.sopt_level = IPPROTO_TCP;
|
|
|
|
sopt.sopt_name = TCP_NODELAY;
|
|
|
|
sopt.sopt_val = &val;
|
|
|
|
sopt.sopt_valsize = sizeof val;
|
|
|
|
val = 1;
|
|
|
|
sosetopt(so, &sopt);
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
|
|
|
so->so_rcv.sb_flags &= ~SB_NOINTR;
|
|
|
|
so->so_rcv.sb_timeo = 0;
|
|
|
|
so->so_snd.sb_flags &= ~SB_NOINTR;
|
|
|
|
so->so_snd.sb_timeo = 0;
|
1999-11-11 17:24:02 +00:00
|
|
|
|
|
|
|
slp = (struct nfssvc_sock *)
|
2000-12-08 21:51:06 +00:00
|
|
|
malloc(sizeof (struct nfssvc_sock), M_NFSSVC,
|
2003-02-19 05:47:46 +00:00
|
|
|
M_WAITOK | M_ZERO);
|
1999-11-11 17:24:02 +00:00
|
|
|
STAILQ_INIT(&slp->ns_rec);
|
|
|
|
TAILQ_INSERT_TAIL(&nfssvc_sockhead, slp, ns_chain);
|
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
slp->ns_so = so;
|
|
|
|
slp->ns_nam = mynam;
|
2003-06-05 06:05:57 +00:00
|
|
|
fhold(fp);
|
1994-05-24 10:09:53 +00:00
|
|
|
slp->ns_fp = fp;
|
|
|
|
s = splnet();
|
|
|
|
so->so_upcallarg = (caddr_t)slp;
|
|
|
|
so->so_upcall = nfsrv_rcv;
|
1998-05-31 18:46:06 +00:00
|
|
|
so->so_rcv.sb_flags |= SB_UPCALL;
|
1994-05-24 10:09:53 +00:00
|
|
|
slp->ns_flag = (SLP_VALID | SLP_NEEDQ);
|
|
|
|
nfsrv_wakenfsd(slp);
|
|
|
|
splx(s);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called by nfssvc() for nfsds. Just loops around servicing rpc requests
|
|
|
|
* until it is killed by a signal.
|
|
|
|
*/
|
1995-12-17 21:14:36 +00:00
|
|
|
static int
|
2002-07-24 23:10:34 +00:00
|
|
|
nfssvc_nfsd(struct thread *td)
|
1994-05-24 10:09:53 +00:00
|
|
|
{
|
2001-09-18 23:32:09 +00:00
|
|
|
int siz;
|
|
|
|
struct nfssvc_sock *slp;
|
2002-07-24 22:27:35 +00:00
|
|
|
struct nfsd *nfsd;
|
1995-06-27 11:07:30 +00:00
|
|
|
struct nfsrv_descript *nd = NULL;
|
1999-12-19 01:55:37 +00:00
|
|
|
struct mbuf *m, *mreq;
|
1995-06-27 11:07:30 +00:00
|
|
|
int error = 0, cacherep, s, sotype, writes_todo;
|
1997-05-10 16:59:36 +00:00
|
|
|
int procrastinate;
|
1995-06-27 11:07:30 +00:00
|
|
|
u_quad_t cur_usec;
|
1994-05-24 10:09:53 +00:00
|
|
|
|
1995-06-27 11:07:30 +00:00
|
|
|
#ifndef nolint
|
|
|
|
cacherep = RC_DOIT;
|
|
|
|
writes_todo = 0;
|
|
|
|
#endif
|
2002-07-24 22:27:35 +00:00
|
|
|
nfsd = (struct nfsd *)
|
2003-02-19 05:47:46 +00:00
|
|
|
malloc(sizeof (struct nfsd), M_NFSD, M_WAITOK | M_ZERO);
|
2002-07-24 22:27:35 +00:00
|
|
|
s = splnet();
|
|
|
|
nfsd->nfsd_td = td;
|
|
|
|
TAILQ_INSERT_TAIL(&nfsd_head, nfsd, nfsd_chain);
|
|
|
|
nfs_numnfsd++;
|
1997-11-24 14:18:00 +00:00
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
/*
|
|
|
|
* Loop getting rpc requests until SIGKILL.
|
|
|
|
*/
|
|
|
|
for (;;) {
|
1995-06-27 11:07:30 +00:00
|
|
|
if ((nfsd->nfsd_flag & NFSD_REQINPROG) == 0) {
|
2002-07-11 17:54:58 +00:00
|
|
|
while (nfsd->nfsd_slp == NULL &&
|
1994-10-17 17:47:45 +00:00
|
|
|
(nfsd_head_flag & NFSD_CHECKSLP) == 0) {
|
1995-06-27 11:07:30 +00:00
|
|
|
nfsd->nfsd_flag |= NFSD_WAITING;
|
1994-05-24 10:09:53 +00:00
|
|
|
nfsd_waiting++;
|
2003-03-02 16:54:40 +00:00
|
|
|
error = tsleep(nfsd, PSOCK | PCATCH,
|
2003-07-02 08:08:32 +00:00
|
|
|
"-", 0);
|
1994-05-24 10:09:53 +00:00
|
|
|
nfsd_waiting--;
|
|
|
|
if (error)
|
|
|
|
goto done;
|
|
|
|
}
|
2002-07-11 17:54:58 +00:00
|
|
|
if (nfsd->nfsd_slp == NULL &&
|
1994-10-17 17:47:45 +00:00
|
|
|
(nfsd_head_flag & NFSD_CHECKSLP) != 0) {
|
2001-09-18 23:32:09 +00:00
|
|
|
TAILQ_FOREACH(slp, &nfssvc_sockhead, ns_chain) {
|
1994-05-24 10:09:53 +00:00
|
|
|
if ((slp->ns_flag & (SLP_VALID | SLP_DOREC))
|
|
|
|
== (SLP_VALID | SLP_DOREC)) {
|
|
|
|
slp->ns_flag &= ~SLP_DOREC;
|
|
|
|
slp->ns_sref++;
|
1995-06-27 11:07:30 +00:00
|
|
|
nfsd->nfsd_slp = slp;
|
1994-05-24 10:09:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-04-04 19:13:35 +00:00
|
|
|
if (slp == NULL)
|
1994-10-17 17:47:45 +00:00
|
|
|
nfsd_head_flag &= ~NFSD_CHECKSLP;
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
2002-07-11 17:54:58 +00:00
|
|
|
if ((slp = nfsd->nfsd_slp) == NULL)
|
1994-05-24 10:09:53 +00:00
|
|
|
continue;
|
|
|
|
if (slp->ns_flag & SLP_VALID) {
|
|
|
|
if (slp->ns_flag & SLP_DISCONN)
|
|
|
|
nfsrv_zapsock(slp);
|
|
|
|
else if (slp->ns_flag & SLP_NEEDQ) {
|
|
|
|
slp->ns_flag &= ~SLP_NEEDQ;
|
1999-02-25 00:03:51 +00:00
|
|
|
(void) nfs_slplock(slp, 1);
|
1994-05-24 10:09:53 +00:00
|
|
|
nfsrv_rcv(slp->ns_so, (caddr_t)slp,
|
2003-02-19 05:47:46 +00:00
|
|
|
M_TRYWAIT);
|
1999-02-25 00:03:51 +00:00
|
|
|
nfs_slpunlock(slp);
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
1995-06-27 11:07:30 +00:00
|
|
|
error = nfsrv_dorec(slp, nfsd, &nd);
|
1998-03-30 09:56:58 +00:00
|
|
|
cur_usec = nfs_curusec();
|
2001-09-18 23:32:09 +00:00
|
|
|
if (error && LIST_FIRST(&slp->ns_tq) &&
|
|
|
|
LIST_FIRST(&slp->ns_tq)->nd_time <= cur_usec) {
|
1995-06-27 11:07:30 +00:00
|
|
|
error = 0;
|
|
|
|
cacherep = RC_DOIT;
|
|
|
|
writes_todo = 1;
|
|
|
|
} else
|
|
|
|
writes_todo = 0;
|
|
|
|
nfsd->nfsd_flag |= NFSD_REQINPROG;
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
error = 0;
|
1995-06-27 11:07:30 +00:00
|
|
|
slp = nfsd->nfsd_slp;
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
|
|
|
if (error || (slp->ns_flag & SLP_VALID) == 0) {
|
1995-06-27 11:07:30 +00:00
|
|
|
if (nd) {
|
|
|
|
free((caddr_t)nd, M_NFSRVDESC);
|
|
|
|
nd = NULL;
|
|
|
|
}
|
2002-07-11 17:54:58 +00:00
|
|
|
nfsd->nfsd_slp = NULL;
|
1995-06-27 11:07:30 +00:00
|
|
|
nfsd->nfsd_flag &= ~NFSD_REQINPROG;
|
1994-05-24 10:09:53 +00:00
|
|
|
nfsrv_slpderef(slp);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
splx(s);
|
1999-02-25 00:03:51 +00:00
|
|
|
sotype = slp->ns_so->so_type;
|
1995-06-27 11:07:30 +00:00
|
|
|
if (nd) {
|
1998-03-30 09:56:58 +00:00
|
|
|
getmicrotime(&nd->nd_starttime);
|
1995-06-27 11:07:30 +00:00
|
|
|
if (nd->nd_nam2)
|
|
|
|
nd->nd_nam = nd->nd_nam2;
|
|
|
|
else
|
|
|
|
nd->nd_nam = slp->ns_nam;
|
1994-05-24 10:09:53 +00:00
|
|
|
|
1995-06-27 11:07:30 +00:00
|
|
|
/*
|
|
|
|
* Check to see if authorization is needed.
|
|
|
|
*/
|
2001-09-28 04:37:08 +00:00
|
|
|
cacherep = nfsrv_getcache(nd, &mreq);
|
1994-05-24 10:09:53 +00:00
|
|
|
|
2001-09-18 23:32:09 +00:00
|
|
|
if (nfs_privport) {
|
1997-03-27 20:01:07 +00:00
|
|
|
/* Check if source port is privileged */
|
|
|
|
u_short port;
|
1997-08-16 19:16:27 +00:00
|
|
|
struct sockaddr *nam = nd->nd_nam;
|
1997-03-27 20:01:07 +00:00
|
|
|
struct sockaddr_in *sin;
|
|
|
|
|
1997-08-16 19:16:27 +00:00
|
|
|
sin = (struct sockaddr_in *)nam;
|
2002-07-15 19:40:23 +00:00
|
|
|
/*
|
|
|
|
* INET/INET6 - same code:
|
|
|
|
* sin_port and sin6_port are at same offset
|
|
|
|
*/
|
1997-03-27 20:01:07 +00:00
|
|
|
port = ntohs(sin->sin_port);
|
2001-09-18 23:32:09 +00:00
|
|
|
if (port >= IPPORT_RESERVED &&
|
1997-04-30 09:51:37 +00:00
|
|
|
nd->nd_procnum != NFSPROC_NULL) {
|
2002-07-15 19:40:23 +00:00
|
|
|
#if defined(INET6) && defined(KLD_MODULE)
|
|
|
|
/* do not use ip6_sprintf: the nfs module should work without INET6 */
|
|
|
|
char b6[INET6_ADDRSTRLEN];
|
|
|
|
#define ip6_sprintf(a) \
|
|
|
|
(sprintf(b6, "%x:%x:%x:%x:%x:%x:%x:%x", \
|
|
|
|
(a)->s6_addr16[0], (a)->s6_addr16[1], \
|
|
|
|
(a)->s6_addr16[2], (a)->s6_addr16[3], \
|
|
|
|
(a)->s6_addr16[4], (a)->s6_addr16[5], \
|
|
|
|
(a)->s6_addr16[6], (a)->s6_addr16[7]), \
|
|
|
|
b6)
|
|
|
|
#endif
|
1997-03-27 20:01:07 +00:00
|
|
|
nd->nd_procnum = NFSPROC_NOOP;
|
|
|
|
nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
|
|
|
cacherep = RC_DOIT;
|
|
|
|
printf("NFS request from unprivileged port (%s:%d)\n",
|
2002-07-15 19:40:23 +00:00
|
|
|
#ifdef INET6
|
|
|
|
sin->sin_family == AF_INET6 ?
|
|
|
|
ip6_sprintf(&satosin6(sin)->sin6_addr) :
|
|
|
|
#undef ip6_sprintf
|
|
|
|
#endif
|
1997-03-27 20:01:07 +00:00
|
|
|
inet_ntoa(sin->sin_addr), port);
|
|
|
|
}
|
1995-06-27 11:07:30 +00:00
|
|
|
}
|
1997-03-27 20:01:07 +00:00
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
|
|
|
|
1995-06-27 11:07:30 +00:00
|
|
|
/*
|
|
|
|
* Loop to get all the write rpc relies that have been
|
|
|
|
* gathered together.
|
|
|
|
*/
|
|
|
|
do {
|
|
|
|
switch (cacherep) {
|
|
|
|
case RC_DOIT:
|
1997-05-10 16:59:36 +00:00
|
|
|
if (nd && (nd->nd_flag & ND_NFSV3))
|
|
|
|
procrastinate = nfsrvw_procrastinate_v3;
|
|
|
|
else
|
|
|
|
procrastinate = nfsrvw_procrastinate;
|
1995-06-27 11:07:30 +00:00
|
|
|
if (writes_todo || (nd->nd_procnum == NFSPROC_WRITE &&
|
1997-05-10 16:59:36 +00:00
|
|
|
procrastinate > 0 && !notstarted))
|
1995-06-27 11:07:30 +00:00
|
|
|
error = nfsrv_writegather(&nd, slp,
|
2001-09-12 08:38:13 +00:00
|
|
|
nfsd->nfsd_td, &mreq);
|
1995-06-27 11:07:30 +00:00
|
|
|
else
|
|
|
|
error = (*(nfsrv3_procs[nd->nd_procnum]))(nd,
|
2001-09-12 08:38:13 +00:00
|
|
|
slp, nfsd->nfsd_td, &mreq);
|
1995-06-27 11:07:30 +00:00
|
|
|
if (mreq == NULL)
|
|
|
|
break;
|
1999-06-23 04:44:14 +00:00
|
|
|
if (error != 0 && error != NFSERR_RETVOID) {
|
2001-09-18 23:32:09 +00:00
|
|
|
nfsrvstats.srv_errs++;
|
1995-06-27 11:07:30 +00:00
|
|
|
nfsrv_updatecache(nd, FALSE, mreq);
|
|
|
|
if (nd->nd_nam2)
|
1997-08-16 19:16:27 +00:00
|
|
|
FREE(nd->nd_nam2, M_SONAME);
|
1994-05-24 10:09:53 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-09-18 23:32:09 +00:00
|
|
|
nfsrvstats.srvrpccnt[nd->nd_procnum]++;
|
1995-06-27 11:07:30 +00:00
|
|
|
nfsrv_updatecache(nd, TRUE, mreq);
|
2002-07-11 17:54:58 +00:00
|
|
|
nd->nd_mrep = NULL;
|
2003-05-31 18:20:26 +00:00
|
|
|
/* FALLTHROUGH */
|
1995-06-27 11:07:30 +00:00
|
|
|
case RC_REPLY:
|
2002-09-18 19:44:14 +00:00
|
|
|
siz = m_length(mreq, NULL);
|
1994-05-24 10:09:53 +00:00
|
|
|
if (siz <= 0 || siz > NFS_MAXPACKET) {
|
|
|
|
printf("mbuf siz=%d\n",siz);
|
|
|
|
panic("Bad nfs svc reply");
|
|
|
|
}
|
|
|
|
m = mreq;
|
|
|
|
m->m_pkthdr.len = siz;
|
2002-07-11 17:54:58 +00:00
|
|
|
m->m_pkthdr.rcvif = NULL;
|
1994-05-24 10:09:53 +00:00
|
|
|
/*
|
|
|
|
* For stream protocols, prepend a Sun RPC
|
|
|
|
* Record Mark.
|
|
|
|
*/
|
|
|
|
if (sotype == SOCK_STREAM) {
|
2003-02-19 05:47:46 +00:00
|
|
|
M_PREPEND(m, NFSX_UNSIGNED, M_TRYWAIT);
|
1998-05-31 20:09:01 +00:00
|
|
|
*mtod(m, u_int32_t *) = htonl(0x80000000 | siz);
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
1999-02-25 00:03:51 +00:00
|
|
|
if (slp->ns_so->so_proto->pr_flags & PR_CONNREQUIRED)
|
|
|
|
(void) nfs_slplock(slp, 1);
|
1994-05-24 10:09:53 +00:00
|
|
|
if (slp->ns_flag & SLP_VALID)
|
2001-09-18 23:32:09 +00:00
|
|
|
error = nfsrv_send(slp->ns_so, nd->nd_nam2, m);
|
1994-05-24 10:09:53 +00:00
|
|
|
else {
|
|
|
|
error = EPIPE;
|
|
|
|
m_freem(m);
|
|
|
|
}
|
1995-06-27 11:07:30 +00:00
|
|
|
if (nd->nd_nam2)
|
1997-08-16 19:16:27 +00:00
|
|
|
FREE(nd->nd_nam2, M_SONAME);
|
1994-05-24 10:09:53 +00:00
|
|
|
if (nd->nd_mrep)
|
|
|
|
m_freem(nd->nd_mrep);
|
|
|
|
if (error == EPIPE)
|
|
|
|
nfsrv_zapsock(slp);
|
1999-02-25 00:03:51 +00:00
|
|
|
if (slp->ns_so->so_proto->pr_flags & PR_CONNREQUIRED)
|
|
|
|
nfs_slpunlock(slp);
|
1994-05-24 10:09:53 +00:00
|
|
|
if (error == EINTR || error == ERESTART) {
|
1995-06-27 11:07:30 +00:00
|
|
|
free((caddr_t)nd, M_NFSRVDESC);
|
1994-05-24 10:09:53 +00:00
|
|
|
nfsrv_slpderef(slp);
|
|
|
|
s = splnet();
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
break;
|
1995-06-27 11:07:30 +00:00
|
|
|
case RC_DROPIT:
|
1994-05-24 10:09:53 +00:00
|
|
|
m_freem(nd->nd_mrep);
|
1998-09-01 02:31:52 +00:00
|
|
|
if (nd->nd_nam2)
|
|
|
|
FREE(nd->nd_nam2, M_SONAME);
|
1994-05-24 10:09:53 +00:00
|
|
|
break;
|
1995-06-27 11:07:30 +00:00
|
|
|
};
|
|
|
|
if (nd) {
|
|
|
|
FREE((caddr_t)nd, M_NFSRVDESC);
|
|
|
|
nd = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if there are outstanding writes that
|
|
|
|
* need to be serviced.
|
|
|
|
*/
|
1998-03-30 09:56:58 +00:00
|
|
|
cur_usec = nfs_curusec();
|
1995-06-27 11:07:30 +00:00
|
|
|
s = splsoftclock();
|
2001-09-18 23:32:09 +00:00
|
|
|
if (LIST_FIRST(&slp->ns_tq) &&
|
|
|
|
LIST_FIRST(&slp->ns_tq)->nd_time <= cur_usec) {
|
1995-06-27 11:07:30 +00:00
|
|
|
cacherep = RC_DOIT;
|
|
|
|
writes_todo = 1;
|
|
|
|
} else
|
|
|
|
writes_todo = 0;
|
|
|
|
splx(s);
|
|
|
|
} while (writes_todo);
|
1994-05-24 10:09:53 +00:00
|
|
|
s = splnet();
|
1995-06-27 11:07:30 +00:00
|
|
|
if (nfsrv_dorec(slp, nfsd, &nd)) {
|
|
|
|
nfsd->nfsd_flag &= ~NFSD_REQINPROG;
|
|
|
|
nfsd->nfsd_slp = NULL;
|
1994-05-24 10:09:53 +00:00
|
|
|
nfsrv_slpderef(slp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
done:
|
1995-06-27 11:07:30 +00:00
|
|
|
TAILQ_REMOVE(&nfsd_head, nfsd, nfsd_chain);
|
1994-05-24 10:09:53 +00:00
|
|
|
splx(s);
|
1995-06-27 11:07:30 +00:00
|
|
|
free((caddr_t)nfsd, M_NFSD);
|
1994-05-24 10:09:53 +00:00
|
|
|
if (--nfs_numnfsd == 0)
|
|
|
|
nfsrv_init(TRUE); /* Reinitialize everything */
|
|
|
|
return (error);
|
|
|
|
}
|
1998-05-31 17:27:58 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Shut down a socket associated with an nfssvc_sock structure.
|
|
|
|
* Should be called with the send lock set, if required.
|
|
|
|
* The trick here is to increment the sref at the start, so that the nfsds
|
|
|
|
* will stop using it and clear ns_flag at the end so that it will not be
|
|
|
|
* reassigned during cleanup.
|
|
|
|
*/
|
|
|
|
static void
|
2001-09-18 23:32:09 +00:00
|
|
|
nfsrv_zapsock(struct nfssvc_sock *slp)
|
1998-05-31 17:27:58 +00:00
|
|
|
{
|
2001-09-18 23:32:09 +00:00
|
|
|
struct nfsrv_descript *nwp, *nnwp;
|
1998-05-31 17:27:58 +00:00
|
|
|
struct socket *so;
|
|
|
|
struct file *fp;
|
|
|
|
struct nfsrv_rec *rec;
|
|
|
|
int s;
|
|
|
|
|
|
|
|
slp->ns_flag &= ~SLP_ALLFLAGS;
|
|
|
|
fp = slp->ns_fp;
|
|
|
|
if (fp) {
|
2002-07-11 17:54:58 +00:00
|
|
|
slp->ns_fp = NULL;
|
1998-05-31 17:27:58 +00:00
|
|
|
so = slp->ns_so;
|
1998-05-31 18:46:06 +00:00
|
|
|
so->so_rcv.sb_flags &= ~SB_UPCALL;
|
1998-05-31 17:27:58 +00:00
|
|
|
so->so_upcall = NULL;
|
1998-05-31 18:46:06 +00:00
|
|
|
so->so_upcallarg = NULL;
|
1998-05-31 17:27:58 +00:00
|
|
|
soshutdown(so, 2);
|
2002-07-11 17:54:58 +00:00
|
|
|
closef(fp, NULL);
|
1998-05-31 17:27:58 +00:00
|
|
|
if (slp->ns_nam)
|
|
|
|
FREE(slp->ns_nam, M_SONAME);
|
|
|
|
m_freem(slp->ns_raw);
|
1999-01-27 22:42:27 +00:00
|
|
|
while ((rec = STAILQ_FIRST(&slp->ns_rec)) != NULL) {
|
1998-05-31 17:27:58 +00:00
|
|
|
STAILQ_REMOVE_HEAD(&slp->ns_rec, nr_link);
|
|
|
|
if (rec->nr_address)
|
|
|
|
FREE(rec->nr_address, M_SONAME);
|
|
|
|
m_freem(rec->nr_packet);
|
|
|
|
free(rec, M_NFSRVDESC);
|
|
|
|
}
|
|
|
|
s = splsoftclock();
|
2001-09-18 23:32:09 +00:00
|
|
|
for (nwp = LIST_FIRST(&slp->ns_tq); nwp; nwp = nnwp) {
|
|
|
|
nnwp = LIST_NEXT(nwp, nd_tq);
|
1998-05-31 17:27:58 +00:00
|
|
|
LIST_REMOVE(nwp, nd_tq);
|
|
|
|
free((caddr_t)nwp, M_NFSRVDESC);
|
|
|
|
}
|
|
|
|
LIST_INIT(&slp->ns_tq);
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Derefence a server socket structure. If it has no more references and
|
|
|
|
* is no longer valid, you can throw it away.
|
|
|
|
*/
|
|
|
|
void
|
2001-09-18 23:32:09 +00:00
|
|
|
nfsrv_slpderef(struct nfssvc_sock *slp)
|
1998-05-31 17:27:58 +00:00
|
|
|
{
|
2001-09-18 23:32:09 +00:00
|
|
|
|
1998-05-31 17:27:58 +00:00
|
|
|
if (--(slp->ns_sref) == 0 && (slp->ns_flag & SLP_VALID) == 0) {
|
|
|
|
TAILQ_REMOVE(&nfssvc_sockhead, slp, ns_chain);
|
|
|
|
free((caddr_t)slp, M_NFSSVC);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-02-25 00:03:51 +00:00
|
|
|
/*
|
|
|
|
* Lock a socket against others.
|
|
|
|
*/
|
|
|
|
int
|
2001-09-18 23:32:09 +00:00
|
|
|
nfs_slplock(struct nfssvc_sock *slp, int wait)
|
1999-02-25 00:03:51 +00:00
|
|
|
{
|
|
|
|
int *statep = &slp->ns_solock;
|
|
|
|
|
2001-09-18 23:32:09 +00:00
|
|
|
if (!wait && (*statep & NFSRV_SNDLOCK))
|
1999-02-25 00:03:51 +00:00
|
|
|
return(0); /* already locked, fail */
|
2001-09-18 23:32:09 +00:00
|
|
|
while (*statep & NFSRV_SNDLOCK) {
|
|
|
|
*statep |= NFSRV_WANTSND;
|
2003-03-02 16:54:40 +00:00
|
|
|
(void) tsleep(statep, PZERO - 1, "nfsslplck", 0);
|
1999-02-25 00:03:51 +00:00
|
|
|
}
|
2001-09-18 23:32:09 +00:00
|
|
|
*statep |= NFSRV_SNDLOCK;
|
1999-02-25 00:03:51 +00:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Unlock the stream socket for others.
|
|
|
|
*/
|
|
|
|
void
|
2001-09-18 23:32:09 +00:00
|
|
|
nfs_slpunlock(struct nfssvc_sock *slp)
|
1999-02-25 00:03:51 +00:00
|
|
|
{
|
|
|
|
int *statep = &slp->ns_solock;
|
|
|
|
|
2001-09-18 23:32:09 +00:00
|
|
|
if ((*statep & NFSRV_SNDLOCK) == 0)
|
1999-02-25 00:03:51 +00:00
|
|
|
panic("nfs slpunlock");
|
2001-09-18 23:32:09 +00:00
|
|
|
*statep &= ~NFSRV_SNDLOCK;
|
|
|
|
if (*statep & NFSRV_WANTSND) {
|
|
|
|
*statep &= ~NFSRV_WANTSND;
|
2003-03-02 16:54:40 +00:00
|
|
|
wakeup(statep);
|
1999-02-25 00:03:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-05-31 17:27:58 +00:00
|
|
|
/*
|
|
|
|
* Initialize the data structures for the server.
|
|
|
|
* Handshake with any new nfsds starting up to avoid any chance of
|
|
|
|
* corruption.
|
|
|
|
*/
|
|
|
|
void
|
2001-09-18 23:32:09 +00:00
|
|
|
nfsrv_init(int terminating)
|
1998-05-31 17:27:58 +00:00
|
|
|
{
|
2001-09-18 23:32:09 +00:00
|
|
|
struct nfssvc_sock *slp, *nslp;
|
1998-05-31 17:27:58 +00:00
|
|
|
|
|
|
|
if (nfssvc_sockhead_flag & SLP_INIT)
|
|
|
|
panic("nfsd init");
|
|
|
|
nfssvc_sockhead_flag |= SLP_INIT;
|
|
|
|
if (terminating) {
|
2004-04-04 19:13:35 +00:00
|
|
|
for (slp = TAILQ_FIRST(&nfssvc_sockhead); slp != NULL;
|
|
|
|
slp = nslp) {
|
2001-09-18 23:32:09 +00:00
|
|
|
nslp = TAILQ_NEXT(slp, ns_chain);
|
1998-05-31 17:27:58 +00:00
|
|
|
if (slp->ns_flag & SLP_VALID)
|
|
|
|
nfsrv_zapsock(slp);
|
|
|
|
TAILQ_REMOVE(&nfssvc_sockhead, slp, ns_chain);
|
|
|
|
free((caddr_t)slp, M_NFSSVC);
|
|
|
|
}
|
|
|
|
nfsrv_cleancache(); /* And clear out server cache */
|
|
|
|
} else
|
|
|
|
nfs_pub.np_valid = 0;
|
|
|
|
|
|
|
|
TAILQ_INIT(&nfssvc_sockhead);
|
|
|
|
nfssvc_sockhead_flag &= ~SLP_INIT;
|
|
|
|
if (nfssvc_sockhead_flag & SLP_WANTINIT) {
|
|
|
|
nfssvc_sockhead_flag &= ~SLP_WANTINIT;
|
2003-03-02 16:54:40 +00:00
|
|
|
wakeup(&nfssvc_sockhead);
|
1998-05-31 17:27:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TAILQ_INIT(&nfsd_head);
|
|
|
|
nfsd_head_flag &= ~NFSD_CHECKSLP;
|
|
|
|
|
1999-11-11 17:24:02 +00:00
|
|
|
#if 0
|
1998-05-31 17:27:58 +00:00
|
|
|
nfs_udpsock = (struct nfssvc_sock *)
|
2003-02-19 05:47:46 +00:00
|
|
|
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK | M_ZERO);
|
1998-05-31 17:27:58 +00:00
|
|
|
STAILQ_INIT(&nfs_udpsock->ns_rec);
|
|
|
|
TAILQ_INSERT_HEAD(&nfssvc_sockhead, nfs_udpsock, ns_chain);
|
|
|
|
|
|
|
|
nfs_cltpsock = (struct nfssvc_sock *)
|
2003-02-19 05:47:46 +00:00
|
|
|
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK | M_ZERO);
|
1998-05-31 17:27:58 +00:00
|
|
|
STAILQ_INIT(&nfs_cltpsock->ns_rec);
|
|
|
|
TAILQ_INSERT_TAIL(&nfssvc_sockhead, nfs_cltpsock, ns_chain);
|
1999-11-11 17:24:02 +00:00
|
|
|
#endif
|
1998-05-31 17:27:58 +00:00
|
|
|
}
|