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 Leffler 2003-11-07 22:57:09 +00:00
parent bea2b56b26
commit a96756932a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122261
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;
const char *s;
GIANT_REQUIRED; /* XXX until socket locking done */
/*
* Create socket and set its recieve timeout.
*/
@ -977,6 +979,8 @@ bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx,
struct ifaddr *ifa;
struct sockaddr_dl *sdl;
GIANT_REQUIRED; /* XXX until socket locking done */
error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0, td->td_ucred, td);
if (error != 0)
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;
from = NULL;
GIANT_REQUIRED; /* XXX until socket locking done */
/*
* 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 thread *td = &thread0; /* only used for socreate and sobind */
GIANT_REQUIRED; /* XXX until socket locking done */
nmp->nm_so = NULL;
saddr = nmp->nm_nam;
error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype,
@ -377,6 +379,8 @@ nfs_disconnect(struct nfsmount *nmp)
{
struct socket *so;
GIANT_REQUIRED; /* XXX until socket locking done */
if (nmp->nm_so) {
so = nmp->nm_so;
nmp->nm_so = NULL;
@ -411,6 +415,8 @@ nfs_send(struct socket *so, struct sockaddr *nam, struct mbuf *top,
struct sockaddr *sendnam;
int error, soflags, flags;
GIANT_REQUIRED; /* XXX until socket locking done */
KASSERT(rep, ("nfs_send: called with rep == NULL"));
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;
struct thread *td = curthread; /* XXX */
GIANT_REQUIRED; /* XXX until socket locking done */
/*
* Set up arguments for soreceive()
*/

View File

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

View File

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

View File

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