Assert GIANT_REQUIRED where sockets are manipulated. This is

preparatory for MPSAFE network commits and ongoing socket
locking work.

Supported by:	FreeBSD Foundation
This commit is contained in:
sam 2003-11-07 22:57:09 +00:00
parent 866f946f37
commit 3eac15aaa3
6 changed files with 22 additions and 0 deletions

View File

@ -587,6 +587,8 @@ bootpc_call(struct bootpc_globalcontext *gctx, struct thread *td)
int retry; int retry;
const char *s; const char *s;
GIANT_REQUIRED; /* XXX until socket locking done */
/* /*
* Create socket and set its recieve timeout. * Create socket and set its recieve timeout.
*/ */
@ -977,6 +979,8 @@ bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx,
struct ifaddr *ifa; struct ifaddr *ifa;
struct sockaddr_dl *sdl; struct sockaddr_dl *sdl;
GIANT_REQUIRED; /* XXX until socket locking done */
error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0, td->td_ucred, td); error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0, td->td_ucred, td);
if (error != 0) if (error != 0)
panic("nfs_boot: socreate, error=%d", error); panic("nfs_boot: socreate, error=%d", error);

View File

@ -213,6 +213,8 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func,
nam = mhead = NULL; nam = mhead = NULL;
from = NULL; from = NULL;
GIANT_REQUIRED; /* XXX until socket locking done */
/* /*
* Create socket and set its recieve timeout. * Create socket and set its recieve timeout.
*/ */

View File

@ -161,6 +161,8 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep)
struct sockaddr *saddr; struct sockaddr *saddr;
struct thread *td = &thread0; /* only used for socreate and sobind */ struct thread *td = &thread0; /* only used for socreate and sobind */
GIANT_REQUIRED; /* XXX until socket locking done */
nmp->nm_so = NULL; nmp->nm_so = NULL;
saddr = nmp->nm_nam; saddr = nmp->nm_nam;
error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype, error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype,
@ -377,6 +379,8 @@ nfs_disconnect(struct nfsmount *nmp)
{ {
struct socket *so; struct socket *so;
GIANT_REQUIRED; /* XXX until socket locking done */
if (nmp->nm_so) { if (nmp->nm_so) {
so = nmp->nm_so; so = nmp->nm_so;
nmp->nm_so = NULL; nmp->nm_so = NULL;
@ -411,6 +415,8 @@ nfs_send(struct socket *so, struct sockaddr *nam, struct mbuf *top,
struct sockaddr *sendnam; struct sockaddr *sendnam;
int error, soflags, flags; int error, soflags, flags;
GIANT_REQUIRED; /* XXX until socket locking done */
KASSERT(rep, ("nfs_send: called with rep == NULL")); KASSERT(rep, ("nfs_send: called with rep == NULL"));
if (rep->r_flags & R_SOFTTERM) { if (rep->r_flags & R_SOFTTERM) {
@ -484,6 +490,8 @@ nfs_receive(struct nfsreq *rep, struct sockaddr **aname, struct mbuf **mp)
int error, sotype, rcvflg; int error, sotype, rcvflg;
struct thread *td = curthread; /* XXX */ struct thread *td = curthread; /* XXX */
GIANT_REQUIRED; /* XXX until socket locking done */
/* /*
* Set up arguments for soreceive() * Set up arguments for soreceive()
*/ */

View File

@ -376,6 +376,8 @@ nfs_mountroot(struct mount *mp, struct thread *td)
u_long l; u_long l;
char buf[128]; char buf[128];
GIANT_REQUIRED; /* XXX until socket locking done */
#if defined(BOOTP_NFSROOT) && defined(BOOTP) #if defined(BOOTP_NFSROOT) && defined(BOOTP)
bootpc_init(); /* use bootp to get nfs_diskless filled in */ bootpc_init(); /* use bootp to get nfs_diskless filled in */
#elif defined(NFS_ROOT) #elif defined(NFS_ROOT)

View File

@ -425,6 +425,8 @@ nfsrv_rcv(struct socket *so, void *arg, int waitflag)
goto dorecs; goto dorecs;
} }
#endif #endif
GIANT_REQUIRED; /* XXX until socket locking is done */
auio.uio_td = NULL; auio.uio_td = NULL;
if (so->so_type == SOCK_STREAM) { if (so->so_type == SOCK_STREAM) {
/* /*
@ -725,6 +727,8 @@ nfsrv_send(struct socket *so, struct sockaddr *nam, struct mbuf *top)
struct sockaddr *sendnam; struct sockaddr *sendnam;
int error, soflags, flags; int error, soflags, flags;
GIANT_REQUIRED; /* XXX until socket locking is done */
soflags = so->so_proto->pr_flags; soflags = so->so_proto->pr_flags;
if ((soflags & PR_CONNREQUIRED) || (so->so_state & SS_ISCONNECTED)) if ((soflags & PR_CONNREQUIRED) || (so->so_state & SS_ISCONNECTED))
sendnam = NULL; sendnam = NULL;

View File

@ -199,6 +199,8 @@ nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td)
struct socket *so; struct socket *so;
int error, s; int error, s;
GIANT_REQUIRED; /* XXX until socket locking done */
so = fp->f_data; so = fp->f_data;
#if 0 #if 0
tslp = NULL; tslp = NULL;