Index: compat/linux/linux_socket.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/compat/linux/linux_socket.c,v retrieving revision 1.73 diff -u -r1.73 linux_socket.c --- compat/linux/linux_socket.c 14 Apr 2007 10:35:09 -0000 1.73 +++ compat/linux/linux_socket.c 28 Jul 2007 08:13:32 -0000 @@ -670,7 +670,6 @@ * socket and use the file descriptor reference instead of * creating a new one. */ - NET_LOCK_GIANT(); error = fgetsock(td, linux_args.s, &so, &fflag); if (error == 0) { error = EISCONN; @@ -683,7 +682,6 @@ } fputsock(so); } - NET_UNLOCK_GIANT(); return (error); } Index: conf/options =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/conf/options,v retrieving revision 1.603 diff -u -r1.603 options --- conf/options 24 Jul 2007 15:35:01 -0000 1.603 +++ conf/options 28 Jul 2007 08:13:48 -0000 @@ -383,7 +383,6 @@ MBUF_STRESS_TEST NCP NETATALK opt_atalk.h -NET_WITH_GIANT opt_net.h PPP_BSDCOMP opt_ppp.h PPP_DEFLATE opt_ppp.h PPP_FILTER opt_ppp.h Index: dev/ath/if_ath.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/dev/ath/if_ath.c,v retrieving revision 1.172 diff -u -r1.172 if_ath.c --- dev/ath/if_ath.c 24 Jun 2007 01:57:20 -0000 1.172 +++ dev/ath/if_ath.c 28 Jul 2007 13:03:01 -0000 @@ -888,11 +888,9 @@ * truly a bmiss we'll get another interrupt soon and that'll * be dispatched up for processing. */ - if (tsf - lastrx > bmisstimeout) { - NET_LOCK_GIANT(); + if (tsf - lastrx > bmisstimeout) ieee80211_beacon_miss(ic); - NET_UNLOCK_GIANT(); - } else + else sc->sc_stats.ast_bmiss_phantom++; } } @@ -3447,7 +3445,6 @@ int16_t nf; u_int64_t tsf; - NET_LOCK_GIANT(); /* XXX */ DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s: pending %u\n", __func__, npending); ngood = 0; @@ -3715,7 +3712,6 @@ !IFQ_IS_EMPTY(&ifp->if_snd)) ath_start(ifp); - NET_UNLOCK_GIANT(); /* XXX */ #undef PA2DESC } Index: dev/em/if_em.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/dev/em/if_em.c,v retrieving revision 1.182 diff -u -r1.182 if_em.c --- dev/em/if_em.c 27 Jul 2007 14:48:05 -0000 1.182 +++ dev/em/if_em.c 28 Jul 2007 13:03:11 -0000 @@ -1474,7 +1474,6 @@ struct adapter *adapter = context; struct ifnet *ifp; - NET_LOCK_GIANT(); ifp = adapter->ifp; /* @@ -1493,7 +1492,6 @@ } em_enable_intr(adapter); - NET_UNLOCK_GIANT(); } /********************************************************************* Index: dev/streams/streams.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/dev/streams/streams.c,v retrieving revision 1.55 diff -u -r1.55 streams.c --- dev/streams/streams.c 4 Apr 2007 09:11:31 -0000 1.55 +++ dev/streams/streams.c 28 Jul 2007 13:26:28 -0000 @@ -244,9 +244,7 @@ return error; /* An extra reference on `fp' has been held for us by falloc(). */ - NET_LOCK_GIANT(); error = socreate(family, &so, type, protocol, td->td_ucred, td); - NET_UNLOCK_GIANT(); if (error) { fdclose(fdp, fp, fd, td); fdrop(fp, td); Index: kern/kern_descrip.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/kern/kern_descrip.c,v retrieving revision 1.312 diff -u -r1.312 kern_descrip.c --- kern/kern_descrip.c 3 Jul 2007 21:26:06 -0000 1.312 +++ kern/kern_descrip.c 28 Jul 2007 13:31:31 -0000 @@ -2098,8 +2098,6 @@ struct file *fp; int error; - NET_ASSERT_GIANT(); - *spp = NULL; if (fflagp != NULL) *fflagp = 0; @@ -2129,7 +2127,6 @@ fputsock(struct socket *so) { - NET_ASSERT_GIANT(); ACCEPT_LOCK(); SOCK_LOCK(so); sorele(so); Index: kern/kern_poll.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/kern/kern_poll.c,v retrieving revision 1.30 diff -u -r1.30 kern_poll.c --- kern/kern_poll.c 5 Jun 2007 00:00:54 -0000 1.30 +++ kern/kern_poll.c 28 Jul 2007 13:31:53 -0000 @@ -329,7 +329,6 @@ { int i; - NET_LOCK_GIANT(); mtx_lock(&poll_mtx); if (count > poll_each_burst) @@ -339,7 +338,6 @@ pr[i].handler(pr[i].ifp, POLL_ONLY, count); mtx_unlock(&poll_mtx); - NET_UNLOCK_GIANT(); } /* @@ -366,8 +364,6 @@ struct timeval t; int kern_load; - NET_ASSERT_GIANT(); - mtx_lock(&poll_mtx); phase = 5; if (residual_burst > 0) { @@ -417,8 +413,6 @@ int i, cycles; enum poll_cmd arg = POLL_ONLY; - NET_ASSERT_GIANT(); - mtx_lock(&poll_mtx); phase = 3; if (residual_burst == 0) { /* first call in this tick */ @@ -456,8 +450,6 @@ KASSERT(h != NULL, ("%s: handler is NULL", __func__)); KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); - NET_ASSERT_GIANT(); - mtx_lock(&poll_mtx); if (poll_handlers >= POLL_LIST_LEN) { /* @@ -504,7 +496,6 @@ KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); - NET_ASSERT_GIANT(); mtx_lock(&poll_mtx); for (i = 0 ; i < poll_handlers ; i++) @@ -547,7 +538,6 @@ polling = val; - NET_LOCK_GIANT(); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &ifnet, if_link) { if (ifp->if_capabilities & IFCAP_POLLING) { @@ -565,7 +555,6 @@ } } IFNET_RUNLOCK(); - NET_UNLOCK_GIANT(); log(LOG_ERR, "kern.polling.enable is deprecated. Use ifconfig(8)"); Index: kern/sys_socket.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/kern/sys_socket.c,v retrieving revision 1.72 diff -u -r1.72 sys_socket.c --- kern/sys_socket.c 4 Mar 2007 17:50:46 -0000 1.72 +++ kern/sys_socket.c 29 Jul 2007 19:51:33 -0000 @@ -73,21 +73,16 @@ int flags, struct thread *td) { struct socket *so = fp->f_data; +#ifdef MAC int error; - NET_LOCK_GIANT(); -#ifdef MAC SOCK_LOCK(so); error = mac_check_socket_receive(active_cred, so); SOCK_UNLOCK(so); - if (error) { - NET_UNLOCK_GIANT(); + if (error) return (error); - } #endif - error = soreceive(so, 0, uio, 0, 0, 0); - NET_UNLOCK_GIANT(); - return (error); + return (soreceive(so, 0, uio, 0, 0, 0)); } /* ARGSUSED */ @@ -98,15 +93,12 @@ struct socket *so = fp->f_data; int error; - NET_LOCK_GIANT(); #ifdef MAC SOCK_LOCK(so); error = mac_check_socket_send(active_cred, so); SOCK_UNLOCK(so); - if (error) { - NET_UNLOCK_GIANT(); + if (error) return (error); - } #endif error = sosend(so, 0, uio, 0, 0, 0, uio->uio_td); if (error == EPIPE && (so->so_options & SO_NOSIGPIPE) == 0) { @@ -114,7 +106,6 @@ psignal(uio->uio_td->td_proc, SIGPIPE); PROC_UNLOCK(uio->uio_td->td_proc); } - NET_UNLOCK_GIANT(); return (error); } @@ -125,9 +116,7 @@ struct socket *so = fp->f_data; int error = 0; - NET_LOCK_GIANT(); switch (cmd) { - case FIONBIO: SOCK_LOCK(so); if (*(int *)data) @@ -207,8 +196,7 @@ (so, cmd, data, 0, td)); break; } - NET_UNLOCK_GIANT(); - return(error); + return (error); } int @@ -216,22 +204,16 @@ struct thread *td) { struct socket *so = fp->f_data; +#ifdef MAC int error; - NET_LOCK_GIANT(); -#ifdef MAC SOCK_LOCK(so); error = mac_check_socket_poll(active_cred, so); SOCK_UNLOCK(so); - if (error) { - NET_UNLOCK_GIANT(); + if (error) return (error); - } #endif - error = sopoll(so, events, fp->f_cred, td); - NET_UNLOCK_GIANT(); - - return (error); + return (sopoll(so, events, fp->f_cred, td)); } int @@ -239,19 +221,18 @@ struct thread *td) { struct socket *so = fp->f_data; +#ifdef MAC int error; +#endif bzero((caddr_t)ub, sizeof (*ub)); ub->st_mode = S_IFSOCK; - NET_LOCK_GIANT(); #ifdef MAC SOCK_LOCK(so); error = mac_check_socket_stat(active_cred, so); SOCK_UNLOCK(so); - if (error) { - NET_UNLOCK_GIANT(); + if (error) return (error); - } #endif /* * If SBS_CANTRCVMORE is set, but there's still data left in the @@ -269,9 +250,7 @@ ub->st_size = so->so_rcv.sb_cc - so->so_rcv.sb_ctl; ub->st_uid = so->so_cred->cr_uid; ub->st_gid = so->so_cred->cr_gid; - error = (*so->so_proto->pr_usrreqs->pru_sense)(so, ub); - NET_UNLOCK_GIANT(); - return (error); + return (*so->so_proto->pr_usrreqs->pru_sense)(so, ub); } /* @@ -287,13 +266,11 @@ int error = 0; struct socket *so; - NET_LOCK_GIANT(); so = fp->f_data; fp->f_ops = &badfileops; fp->f_data = NULL; if (so) error = soclose(so); - NET_UNLOCK_GIANT(); return (error); } Index: kern/uipc_domain.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/kern/uipc_domain.c,v retrieving revision 1.50 diff -u -r1.50 uipc_domain.c --- kern/uipc_domain.c 27 Jul 2007 11:59:56 -0000 1.50 +++ kern/uipc_domain.c 28 Jul 2007 11:38:16 -0000 @@ -453,8 +453,6 @@ struct domain *dp; struct protosw *pr; - NET_ASSERT_GIANT(); - for (dp = domains; dp; dp = dp->dom_next) for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) if (pr->pr_slowtimo) @@ -468,8 +466,6 @@ struct domain *dp; struct protosw *pr; - NET_ASSERT_GIANT(); - for (dp = domains; dp; dp = dp->dom_next) for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) if (pr->pr_fasttimo) Index: kern/uipc_syscalls.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/kern/uipc_syscalls.c,v retrieving revision 1.257 diff -u -r1.257 uipc_syscalls.c --- kern/uipc_syscalls.c 2 Jul 2007 12:50:53 -0000 1.257 +++ kern/uipc_syscalls.c 29 Jul 2007 20:08:20 -0000 @@ -175,10 +175,8 @@ if (error) return (error); /* An extra reference on `fp' has been held for us by falloc(). */ - NET_LOCK_GIANT(); error = socreate(uap->domain, &so, uap->type, uap->protocol, td->td_ucred, td); - NET_UNLOCK_GIANT(); if (error) { fdclose(fdp, fp, fd, td); } else { @@ -225,25 +223,22 @@ struct file *fp; int error; - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, fd, &fp, NULL); if (error) - goto done2; + return (error); so = fp->f_data; #ifdef MAC SOCK_LOCK(so); error = mac_check_socket_bind(td->td_ucred, so, sa); SOCK_UNLOCK(so); if (error) - goto done1; + goto done; #endif error = sobind(so, sa, td); #ifdef MAC -done1: +done: #endif fdrop(fp, td); -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -260,7 +255,6 @@ struct file *fp; int error; - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, uap->s, &fp, NULL); if (error == 0) { so = fp->f_data; @@ -277,7 +271,6 @@ #endif fdrop(fp, td); } - NET_UNLOCK_GIANT(); return(error); } @@ -357,10 +350,9 @@ } fdp = td->td_proc->p_fd; - NET_LOCK_GIANT(); error = getsock(fdp, s, &headfp, &fflag); if (error) - goto done2; + return (error); head = headfp->f_data; if ((head->so_options & SO_ACCEPTCONN) == 0) { error = EINVAL; @@ -491,8 +483,6 @@ if (nfp != NULL) fdrop(nfp, td); fdrop(headfp, td); -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -550,10 +540,9 @@ int error; int interrupted = 0; - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, fd, &fp, NULL); if (error) - goto done2; + return (error); so = fp->f_data; if (so->so_state & SS_ISCONNECTING) { error = EALREADY; @@ -595,8 +584,6 @@ error = EINTR; done1: fdrop(fp, td); -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -623,11 +610,10 @@ return (error); #endif - NET_LOCK_GIANT(); error = socreate(uap->domain, &so1, uap->type, uap->protocol, td->td_ucred, td); if (error) - goto done2; + return (error); error = socreate(uap->domain, &so2, uap->type, uap->protocol, td->td_ucred, td); if (error) @@ -670,7 +656,7 @@ goto free4; fdrop(fp1, td); fdrop(fp2, td); - goto done2; + return (0); free4: fdclose(fdp, fp2, sv[1], td); fdrop(fp2, td); @@ -683,8 +669,6 @@ free1: if (so1 != NULL) (void)soclose(so1); -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -770,10 +754,9 @@ struct uio *ktruio = NULL; #endif - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, s, &fp, NULL); if (error) - goto bad2; + return (error); so = (struct socket *)fp->f_data; #ifdef MAC @@ -826,8 +809,6 @@ #endif bad: fdrop(fp, td); -bad2: - NET_UNLOCK_GIANT(); return (error); } @@ -968,12 +949,9 @@ if(controlp != NULL) *controlp = 0; - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, s, &fp, NULL); - if (error) { - NET_UNLOCK_GIANT(); + if (error) return (error); - } so = fp->f_data; #ifdef MAC @@ -982,7 +960,6 @@ SOCK_UNLOCK(so); if (error) { fdrop(fp, td); - NET_UNLOCK_GIANT(); return (error); } #endif @@ -998,7 +975,6 @@ for (i = 0; i < mp->msg_iovlen; i++, iov++) { if ((auio.uio_resid += iov->iov_len) < 0) { fdrop(fp, td); - NET_UNLOCK_GIANT(); return (EINVAL); } } @@ -1094,7 +1070,6 @@ } out: fdrop(fp, td); - NET_UNLOCK_GIANT(); if (fromsa) FREE(fromsa, M_SONAME); @@ -1285,14 +1260,12 @@ struct file *fp; int error; - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, uap->s, &fp, NULL); if (error == 0) { so = fp->f_data; error = soshutdown(so, uap->how); fdrop(fp, td); } - NET_UNLOCK_GIANT(); return (error); } @@ -1349,14 +1322,12 @@ panic("kern_setsockopt called with bad valseg"); } - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, s, &fp, NULL); if (error == 0) { so = fp->f_data; error = sosetopt(so, &sopt); fdrop(fp, td); } - NET_UNLOCK_GIANT(); return(error); } @@ -1429,7 +1400,6 @@ panic("kern_getsockopt called with bad valseg"); } - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, s, &fp, NULL); if (error == 0) { so = fp->f_data; @@ -1437,7 +1407,6 @@ *valsize = sopt.sopt_valsize; fdrop(fp, td); } - NET_UNLOCK_GIANT(); return (error); } @@ -1492,10 +1461,9 @@ if (*alen < 0) return (EINVAL); - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, fd, &fp, NULL); if (error) - goto done; + return (error); so = fp->f_data; *sa = NULL; error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, sa); @@ -1512,8 +1480,6 @@ free(*sa, M_SONAME); *sa = NULL; } -done: - NET_UNLOCK_GIANT(); return (error); } @@ -1588,14 +1554,13 @@ if (*alen < 0) return (EINVAL); - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, fd, &fp, NULL); if (error) - goto done2; + return (error); so = fp->f_data; if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) { error = ENOTCONN; - goto done1; + goto done; } *sa = NULL; error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, sa); @@ -1611,10 +1576,8 @@ free(*sa, M_SONAME); *sa = NULL; } -done1: +done: fdrop(fp, td); -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -1823,8 +1786,6 @@ int error, hdrlen = 0, mnw = 0; int vfslocked; - NET_LOCK_GIANT(); - /* * The file descriptor must be a regular file and have a * backing VM object. @@ -2242,8 +2203,6 @@ if (m) m_freem(m); - NET_UNLOCK_GIANT(); - if (error == ERESTART) error = EINTR; Index: net/bpf.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/net/bpf.c,v retrieving revision 1.179 diff -u -r1.179 bpf.c --- net/bpf.c 28 Jul 2007 07:31:29 -0000 1.179 +++ net/bpf.c 28 Jul 2007 13:01:24 -0000 @@ -645,16 +645,12 @@ BPFD_UNLOCK(d); #endif - NET_LOCK_GIANT(); error = (*ifp->if_output)(ifp, m, &dst, NULL); - NET_UNLOCK_GIANT(); if (mc != NULL) { - if (error == 0) { - NET_LOCK_GIANT(); + if (error == 0) (*ifp->if_input)(ifp, mc); - NET_UNLOCK_GIANT(); - } else + else m_freem(mc); } @@ -776,10 +772,8 @@ if (d->bd_bif == NULL) error = EINVAL; else { - NET_LOCK_GIANT(); ifp = d->bd_bif->bif_ifp; error = (*ifp->if_ioctl)(ifp, cmd, addr); - NET_UNLOCK_GIANT(); } break; } @@ -837,9 +831,7 @@ break; } if (d->bd_promisc == 0) { - NET_LOCK_GIANT(); error = ifpromisc(d->bd_bif->bif_ifp, 1); - NET_UNLOCK_GIANT(); if (error == 0) d->bd_promisc = 1; } Index: net/bpfdesc.h =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/net/bpfdesc.h,v retrieving revision 1.37 diff -u -r1.37 bpfdesc.h --- net/bpfdesc.h 26 Feb 2007 22:24:14 -0000 1.37 +++ net/bpfdesc.h 29 Jul 2007 19:30:56 -0000 @@ -102,10 +102,7 @@ #define BPFD_LOCK(bd) mtx_lock(&(bd)->bd_mtx) #define BPFD_UNLOCK(bd) mtx_unlock(&(bd)->bd_mtx) -#define BPFD_LOCK_ASSERT(bd) do { \ - mtx_assert(&(bd)->bd_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define BPFD_LOCK_ASSERT(bd) mtx_assert(&(bd)->bd_mtx, MA_OWNED); /* Test whether a BPF is ready for read(). */ #define bpf_ready(bd) \ Index: net/netisr.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/net/netisr.c,v retrieving revision 1.19 diff -u -r1.19 netisr.c --- net/netisr.c 27 Jul 2007 11:59:57 -0000 1.19 +++ net/netisr.c 29 Jul 2007 19:44:40 -0000 @@ -28,7 +28,6 @@ */ #include "opt_device_polling.h" -#include "opt_net.h" #include #include Index: netgraph/netflow/netflow.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/netgraph/netflow/netflow.c,v retrieving revision 1.24 diff -u -r1.24 netflow.c --- netgraph/netflow/netflow.c 11 Oct 2006 13:28:37 -0000 1.24 +++ netgraph/netflow/netflow.c 29 Jul 2007 19:31:13 -0000 @@ -616,7 +616,6 @@ header->count = htons(header->count); if (priv->export != NULL) - /* Should also NET_LOCK_GIANT(). */ NG_FWD_ITEM_HOOK_FLAGS(error, item, priv->export, flags); return (error); Index: netinet/in_pcb.h =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/netinet/in_pcb.h,v retrieving revision 1.99 diff -u -r1.99 in_pcb.h --- netinet/in_pcb.h 1 Jul 2007 11:38:27 -0000 1.99 +++ netinet/in_pcb.h 28 Jul 2007 13:02:48 -0000 @@ -269,10 +269,7 @@ #define INP_LOCK_DESTROY(inp) mtx_destroy(&(inp)->inp_mtx) #define INP_LOCK(inp) mtx_lock(&(inp)->inp_mtx) #define INP_UNLOCK(inp) mtx_unlock(&(inp)->inp_mtx) -#define INP_LOCK_ASSERT(inp) do { \ - mtx_assert(&(inp)->inp_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define INP_LOCK_ASSERT(inp) mtx_assert(&(inp)->inp_mtx, MA_OWNED) #define INP_UNLOCK_ASSERT(inp) mtx_assert(&(inp)->inp_mtx, MA_NOTOWNED) #define INP_INFO_LOCK_INIT(ipi, d) \ @@ -282,17 +279,9 @@ #define INP_INFO_WLOCK(ipi) mtx_lock(&(ipi)->ipi_mtx) #define INP_INFO_RUNLOCK(ipi) mtx_unlock(&(ipi)->ipi_mtx) #define INP_INFO_WUNLOCK(ipi) mtx_unlock(&(ipi)->ipi_mtx) -#define INP_INFO_RLOCK_ASSERT(ipi) do { \ - mtx_assert(&(ipi)->ipi_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) -#define INP_INFO_WLOCK_ASSERT(ipi) do { \ - mtx_assert(&(ipi)->ipi_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) -#define INP_INFO_UNLOCK_ASSERT(ipi) do { \ - mtx_assert(&(ipi)->ipi_mtx, MA_NOTOWNED); \ -} while (0) +#define INP_INFO_RLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_mtx, MA_OWNED) +#define INP_INFO_WLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_mtx, MA_OWNED) +#define INP_INFO_UNLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_mtx, MA_NOTOWNED) #define INP_PCBHASH(faddr, lport, fport, mask) \ (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) Index: netinet/ip_dummynet.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/netinet/ip_dummynet.c,v retrieving revision 1.108 diff -u -r1.108 ip_dummynet.c --- netinet/ip_dummynet.c 28 Jul 2007 07:31:30 -0000 1.108 +++ netinet/ip_dummynet.c 28 Jul 2007 13:25:49 -0000 @@ -203,10 +203,7 @@ #define DUMMYNET_LOCK_DESTROY() mtx_destroy(&dummynet_mtx) #define DUMMYNET_LOCK() mtx_lock(&dummynet_mtx) #define DUMMYNET_UNLOCK() mtx_unlock(&dummynet_mtx) -#define DUMMYNET_LOCK_ASSERT() do { \ - mtx_assert(&dummynet_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define DUMMYNET_LOCK_ASSERT() mtx_assert(&dummynet_mtx, MA_OWNED) static int config_pipe(struct dn_pipe *p); static int ip_dn_ctl(struct sockopt *sopt); @@ -738,7 +735,6 @@ void *p; /* generic parameter to handler */ int i; - NET_LOCK_GIANT(); DUMMYNET_LOCK(); heaps[0] = &ready_heap; /* fixed-rate queues */ @@ -825,8 +821,6 @@ dummynet_send(head); callout_reset(&dn_timeout, 1, dummynet, NULL); - - NET_UNLOCK_GIANT(); } static void Index: netinet/ip_fw2.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/netinet/ip_fw2.c,v retrieving revision 1.170 diff -u -r1.170 ip_fw2.c --- netinet/ip_fw2.c 28 Jul 2007 07:31:30 -0000 1.170 +++ netinet/ip_fw2.c 29 Jul 2007 19:31:31 -0000 @@ -147,10 +147,7 @@ #define IPFW_LOCK_INIT(_chain) \ rw_init(&(_chain)->rwmtx, "IPFW static rules") #define IPFW_LOCK_DESTROY(_chain) rw_destroy(&(_chain)->rwmtx) -#define IPFW_WLOCK_ASSERT(_chain) do { \ - rw_assert(&(_chain)->rwmtx, RA_WLOCKED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define IPFW_WLOCK_ASSERT(_chain) rw_assert(&(_chain)->rwmtx, RA_WLOCKED) #define IPFW_RLOCK(p) rw_rlock(&(p)->rwmtx) #define IPFW_RUNLOCK(p) rw_runlock(&(p)->rwmtx) Index: netinet/ip_mroute.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/netinet/ip_mroute.c,v retrieving revision 1.136 diff -u -r1.136 ip_mroute.c --- netinet/ip_mroute.c 28 Jul 2007 07:31:30 -0000 1.136 +++ netinet/ip_mroute.c 28 Jul 2007 13:26:16 -0000 @@ -149,10 +149,7 @@ static struct mtx mrouter_mtx; #define MROUTER_LOCK() mtx_lock(&mrouter_mtx) #define MROUTER_UNLOCK() mtx_unlock(&mrouter_mtx) -#define MROUTER_LOCK_ASSERT() do { \ - mtx_assert(&mrouter_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define MROUTER_LOCK_ASSERT() mtx_assert(&mrouter_mtx, MA_OWNED) #define MROUTER_LOCK_INIT() \ mtx_init(&mrouter_mtx, "IPv4 multicast forwarding", NULL, MTX_DEF) #define MROUTER_LOCK_DESTROY() mtx_destroy(&mrouter_mtx) @@ -160,10 +157,7 @@ static struct mtx mfc_mtx; #define MFC_LOCK() mtx_lock(&mfc_mtx) #define MFC_UNLOCK() mtx_unlock(&mfc_mtx) -#define MFC_LOCK_ASSERT() do { \ - mtx_assert(&mfc_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define MFC_LOCK_ASSERT() mtx_assert(&mfc_mtx, MA_OWNED) #define MFC_LOCK_INIT() mtx_init(&mfc_mtx, "mroute mfc table", NULL, MTX_DEF) #define MFC_LOCK_DESTROY() mtx_destroy(&mfc_mtx) Index: netinet/sctp_input.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/netinet/sctp_input.c,v retrieving revision 1.53 diff -u -r1.53 sctp_input.c --- netinet/sctp_input.c 24 Jul 2007 20:06:01 -0000 1.53 +++ netinet/sctp_input.c 29 Jul 2007 19:31:51 -0000 @@ -2190,11 +2190,9 @@ * We do this to keep the sockets side happy durin * the sonewcon ONLY. */ - NET_LOCK_GIANT(); SCTP_TCB_UNLOCK((*stcb)); so = sonewconn(oso, 0 ); - NET_UNLOCK_GIANT(); SCTP_INP_WLOCK((*stcb)->sctp_ep); SCTP_TCB_LOCK((*stcb)); SCTP_INP_WUNLOCK((*stcb)->sctp_ep); Index: netinet/tcp_syncache.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/netinet/tcp_syncache.c,v retrieving revision 1.128 diff -u -r1.128 tcp_syncache.c --- netinet/tcp_syncache.c 29 Jul 2007 20:13:22 -0000 1.128 +++ netinet/tcp_syncache.c 4 Aug 2007 20:53:22 -0000 @@ -613,7 +613,6 @@ struct tcpcb *tp; char *s; - NET_ASSERT_GIANT(); INP_INFO_WLOCK_ASSERT(&tcbinfo); /* Index: netipsec/xform_ah.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/netipsec/xform_ah.c,v retrieving revision 1.14 diff -u -r1.14 xform_ah.c --- netipsec/xform_ah.c 1 Jul 2007 11:38:29 -0000 1.14 +++ netipsec/xform_ah.c 28 Jul 2007 13:32:16 -0000 @@ -735,8 +735,6 @@ caddr_t ptr; int authsize; - NET_LOCK_GIANT(); - crd = crp->crp_desc; tc = (struct tdb_crypto *) crp->crp_opaque; @@ -769,7 +767,6 @@ if (crp->crp_etype == EAGAIN) { error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); return error; } @@ -863,7 +860,6 @@ IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, mtag); KEY_FREESAV(&sav); - NET_UNLOCK_GIANT(); return error; bad: if (sav) @@ -874,7 +870,6 @@ free(tc, M_XDATA); if (crp != NULL) crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } @@ -1125,8 +1120,6 @@ caddr_t ptr; int err; - NET_LOCK_GIANT(); - tc = (struct tdb_crypto *) crp->crp_opaque; IPSEC_ASSERT(tc != NULL, ("null opaque data area!")); skip = tc->tc_skip; @@ -1154,7 +1147,6 @@ KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); return error; } @@ -1201,7 +1193,6 @@ err = ipsec_process_done(m, isr); KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); - NET_UNLOCK_GIANT(); return err; bad: if (sav) @@ -1211,7 +1202,6 @@ m_freem(m); free(tc, M_XDATA); crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } Index: netipsec/xform_esp.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/netipsec/xform_esp.c,v retrieving revision 1.19 diff -u -r1.19 xform_esp.c --- netipsec/xform_esp.c 9 May 2007 19:37:02 -0000 1.19 +++ netipsec/xform_esp.c 28 Jul 2007 13:32:28 -0000 @@ -462,8 +462,6 @@ struct secasindex *saidx; caddr_t ptr; - NET_LOCK_GIANT(); - crd = crp->crp_desc; IPSEC_ASSERT(crd != NULL, ("null crypto descriptor!")); @@ -501,7 +499,6 @@ if (crp->crp_etype == EAGAIN) { KEY_FREESAV(&sav); error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); return error; } @@ -631,7 +628,6 @@ IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, mtag); KEY_FREESAV(&sav); - NET_UNLOCK_GIANT(); return error; bad: if (sav) @@ -642,7 +638,6 @@ free(tc, M_XDATA); if (crp != NULL) crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } @@ -896,8 +891,6 @@ struct mbuf *m; int err, error; - NET_LOCK_GIANT(); - tc = (struct tdb_crypto *) crp->crp_opaque; IPSEC_ASSERT(tc != NULL, ("null opaque data area!")); m = (struct mbuf *) crp->crp_buf; @@ -926,7 +919,6 @@ KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); return error; } @@ -973,7 +965,6 @@ err = ipsec_process_done(m, isr); KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); - NET_UNLOCK_GIANT(); return err; bad: if (sav) @@ -983,7 +974,6 @@ m_freem(m); free(tc, M_XDATA); crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } Index: netipsec/xform_ipcomp.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/netipsec/xform_ipcomp.c,v retrieving revision 1.10 diff -u -r1.10 xform_ipcomp.c --- netipsec/xform_ipcomp.c 23 Mar 2006 23:26:34 -0000 1.10 +++ netipsec/xform_ipcomp.c 28 Jul 2007 13:39:20 -0000 @@ -219,8 +219,6 @@ u_int8_t nproto; caddr_t addr; - NET_LOCK_GIANT(); - crd = crp->crp_desc; tc = (struct tdb_crypto *) crp->crp_opaque; @@ -252,7 +250,6 @@ if (crp->crp_etype == EAGAIN) { KEY_FREESAV(&sav); error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); return error; } @@ -306,7 +303,6 @@ IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, NULL); KEY_FREESAV(&sav); - NET_UNLOCK_GIANT(); return error; bad: if (sav) @@ -317,7 +313,6 @@ free(tc, M_XDATA); if (crp) crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } @@ -499,8 +494,6 @@ struct mbuf *m; int error, skip, rlen; - NET_LOCK_GIANT(); - tc = (struct tdb_crypto *) crp->crp_opaque; IPSEC_ASSERT(tc != NULL, ("null opaque data area!")); m = (struct mbuf *) crp->crp_buf; @@ -528,7 +521,6 @@ KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); return error; } ipcompstat.ipcomps_noxform++; @@ -582,7 +574,6 @@ error = ipsec_process_done(m, isr); KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); - NET_UNLOCK_GIANT(); return error; bad: if (sav) @@ -592,7 +583,6 @@ m_freem(m); free(tc, M_XDATA); crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } Index: nfsclient/bootp_subr.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/nfsclient/bootp_subr.c,v retrieving revision 1.69 diff -u -r1.69 bootp_subr.c --- nfsclient/bootp_subr.c 27 Feb 2007 17:23:29 -0000 1.69 +++ nfsclient/bootp_subr.c 29 Jul 2007 18:40:19 -0000 @@ -590,8 +590,6 @@ int retry; const char *s; - NET_ASSERT_GIANT(); - /* * Create socket and set its recieve timeout. */ @@ -982,8 +980,6 @@ struct ifaddr *ifa; struct sockaddr_dl *sdl; - NET_ASSERT_GIANT(); - error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0, td->td_ucred, td); if (error != 0) panic("nfs_boot: socreate, error=%d", error); Index: nfsclient/krpc_subr.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/nfsclient/krpc_subr.c,v retrieving revision 1.29 diff -u -r1.29 krpc_subr.c --- nfsclient/krpc_subr.c 16 Mar 2005 08:13:08 -0000 1.29 +++ nfsclient/krpc_subr.c 29 Jul 2007 18:40:23 -0000 @@ -215,8 +215,6 @@ nam = mhead = NULL; from = NULL; - NET_ASSERT_GIANT(); - /* * Create socket and set its recieve timeout. */ Index: nfsclient/nfs_socket.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/nfsclient/nfs_socket.c,v retrieving revision 1.153 diff -u -r1.153 nfs_socket.c --- nfsclient/nfs_socket.c 18 May 2007 19:34:54 -0000 1.153 +++ nfsclient/nfs_socket.c 29 Jul 2007 20:41:07 -0000 @@ -265,8 +265,6 @@ struct sockaddr *saddr; struct thread *td = &thread0; /* only used for socreate and sobind */ - NET_LOCK_GIANT(); - if (nmp->nm_sotype == SOCK_STREAM) { mtx_lock(&nmp->nm_mtx); nmp->nm_nfstcpstate.flags |= NFS_TCP_EXPECT_RPCMARKER; @@ -458,12 +456,10 @@ nmp->nm_sent = 0; nmp->nm_timeouts = 0; mtx_unlock(&nmp->nm_mtx); - NET_UNLOCK_GIANT(); return (0); bad: nfs_disconnect(nmp); - NET_UNLOCK_GIANT(); return (error); } @@ -531,8 +527,6 @@ { struct socket *so; - NET_ASSERT_GIANT(); - mtx_lock(&nmp->nm_mtx); if (nmp->nm_so) { so = nmp->nm_so; @@ -573,14 +567,12 @@ struct sockaddr *sendnam; int error, error2, soflags, flags; - NET_LOCK_GIANT(); - KASSERT(rep, ("nfs_send: called with rep == NULL")); error = nfs_sigintr(rep->r_nmp, rep, rep->r_td); if (error) { m_freem(top); - goto out; + return (error); } mtx_lock(&rep->r_nmp->nm_mtx); mtx_lock(&rep->r_mtx); @@ -589,8 +581,7 @@ mtx_unlock(&rep->r_mtx); mtx_unlock(&rep->r_nmp->nm_mtx); m_freem(top); - error = 0; - goto out; + return (0); } rep->r_flags &= ~R_MUSTRESEND; soflags = rep->r_nmp->nm_soflags; @@ -644,8 +635,6 @@ if (error != EINTR && error != ERESTART && error != EIO && error != EPIPE) error = 0; } -out: - NET_UNLOCK_GIANT(); return (error); } @@ -656,8 +645,6 @@ register struct mbuf *m; int error = 0, sotype, slpflag; - NET_LOCK_GIANT(); - sotype = rep->r_nmp->nm_sotype; /* * For reliable protocols, lock against other senders/receivers @@ -666,7 +653,7 @@ if (sotype != SOCK_DGRAM) { error = nfs_sndlock(rep); if (error) - goto out; + return (error); tryagain: mtx_lock(&rep->r_nmp->nm_mtx); mtx_lock(&rep->r_mtx); @@ -674,15 +661,13 @@ mtx_unlock(&rep->r_mtx); mtx_unlock(&rep->r_nmp->nm_mtx); nfs_sndunlock(rep); - error = 0; - goto out; + return (0); } if (rep->r_flags & R_SOFTTERM) { mtx_unlock(&rep->r_mtx); mtx_unlock(&rep->r_nmp->nm_mtx); nfs_sndunlock(rep); - error = EINTR; - goto out; + return (EINTR); } so = rep->r_nmp->nm_so; if (!so || @@ -692,7 +677,7 @@ error = nfs_reconnect(rep); if (error) { nfs_sndunlock(rep); - goto out; + return (error); } goto tryagain; } @@ -706,7 +691,7 @@ if (error == EINTR || error == ERESTART || (error = nfs_reconnect(rep)) != 0) { nfs_sndunlock(rep); - goto out; + return (error); } goto tryagain; } @@ -730,15 +715,13 @@ slpflag | (PZERO - 1), "nfsreq", 0); if (error == EINTR || error == ERESTART) { /* NFS operations aren't restartable. Map ERESTART to EINTR */ - error = EINTR; mtx_unlock(&rep->r_mtx); - goto out; + return (EINTR); } if (rep->r_flags & R_SOFTTERM) { /* Request was terminated because we exceeded the retries (soft mount) */ - error = ETIMEDOUT; mtx_unlock(&rep->r_mtx); - goto out; + return (ETIMEDOUT); } mtx_unlock(&rep->r_mtx); if (sotype == SOCK_STREAM) { @@ -750,15 +733,13 @@ mtx_unlock(&rep->r_nmp->nm_mtx); error = nfs_sndlock(rep); if (error) - goto out; + return (error); goto tryagain; } else { mtx_unlock(&rep->r_mtx); mtx_unlock(&rep->r_nmp->nm_mtx); } } -out: - NET_UNLOCK_GIANT(); return (error); } @@ -1475,7 +1456,6 @@ rep->r_flags |= R_PIN_REQ; mtx_unlock(&rep->r_mtx); mtx_unlock(&nfs_reqq_mtx); - NET_LOCK_GIANT(); if ((nmp->nm_flag & NFSMNT_NOCONN) == 0) error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, NULL, NULL, curthread); @@ -1483,7 +1463,6 @@ error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, nmp->nm_nam, NULL, curthread); - NET_UNLOCK_GIANT(); mtx_lock(&nfs_reqq_mtx); mtx_lock(&nmp->nm_mtx); mtx_lock(&rep->r_mtx); @@ -1689,7 +1668,6 @@ { struct proc *p; sigset_t tmpset; - int error = 0; if ((nmp->nm_flag & NFSMNT_NFSV4) != 0) return nfs4_sigintr(nmp, rep, td); @@ -1697,18 +1675,15 @@ mtx_lock(&rep->r_mtx); if (rep->r_flags & R_SOFTTERM) { mtx_unlock(&rep->r_mtx); - error = EIO; - goto out; + return (EIO); } else mtx_unlock(&rep->r_mtx); } /* Terminate all requests while attempting a forced unmount. */ - if (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) { - error = EIO; - goto out; - } + if (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) + return (EIO); if (!(nmp->nm_flag & NFSMNT_INT)) - goto out; + return (0); if (td == NULL) return (0); p = td->td_proc; @@ -1725,10 +1700,7 @@ return (EINTR); } PROC_UNLOCK(p); - return (0); -out: - return(error); } /* Index: nfsclient/nfs_vfsops.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/nfsclient/nfs_vfsops.c,v retrieving revision 1.192 diff -u -r1.192 nfs_vfsops.c --- nfsclient/nfs_vfsops.c 23 Mar 2007 08:52:36 -0000 1.192 +++ nfsclient/nfs_vfsops.c 29 Jul 2007 19:23:29 -0000 @@ -408,8 +408,6 @@ char buf[128]; char *cp; - NET_ASSERT_GIANT(); - #if defined(BOOTP_NFSROOT) && defined(BOOTP) bootpc_init(); /* use bootp to get nfs_diskless filled in */ #elif defined(NFS_ROOT) Index: nfsserver/nfs_srvsock.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/nfsserver/nfs_srvsock.c,v retrieving revision 1.103 diff -u -r1.103 nfs_srvsock.c --- nfsserver/nfs_srvsock.c 15 Apr 2007 15:50:50 -0000 1.103 +++ nfsserver/nfs_srvsock.c 29 Jul 2007 19:26:08 -0000 @@ -413,12 +413,6 @@ struct uio auio; int flags, error; - /* - * XXXRW: For now, assert Giant here since the NFS server upcall - * will perform socket operations requiring Giant in a non-mpsafe - * kernel. - */ - NET_ASSERT_GIANT(); NFSD_UNLOCK_ASSERT(); /* XXXRW: Unlocked read. */ @@ -761,7 +755,6 @@ struct sockaddr *sendnam; int error, soflags, flags; - NET_ASSERT_GIANT(); NFSD_UNLOCK_ASSERT(); soflags = so->so_proto->pr_flags; Index: nfsserver/nfs_srvsubs.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/nfsserver/nfs_srvsubs.c,v retrieving revision 1.148 diff -u -r1.148 nfs_srvsubs.c --- nfsserver/nfs_srvsubs.c 27 Jul 2007 11:59:57 -0000 1.148 +++ nfsserver/nfs_srvsubs.c 29 Jul 2007 19:26:21 -0000 @@ -526,7 +526,6 @@ static int registered; int error = 0; - NET_LOCK_GIANT(); switch (type) { case MOD_LOAD: mtx_init(&nfsd_mtx, "nfsd_mtx", NULL, MTX_DEF); @@ -577,7 +576,6 @@ error = EOPNOTSUPP; break; } - NET_UNLOCK_GIANT(); return error; } static moduledata_t nfsserver_mod = { Index: nfsserver/nfs_syscalls.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/nfsserver/nfs_syscalls.c,v retrieving revision 1.115 diff -u -r1.115 nfs_syscalls.c --- nfsserver/nfs_syscalls.c 27 Jul 2007 11:59:57 -0000 1.115 +++ nfsserver/nfs_syscalls.c 29 Jul 2007 19:28:19 -0000 @@ -134,7 +134,6 @@ error = priv_check(td, PRIV_NFS_DAEMON); if (error) return (error); - NET_LOCK_GIANT(); NFSD_LOCK(); while (nfssvc_sockhead_flag & SLP_INIT) { nfssvc_sockhead_flag |= SLP_WANTINIT; @@ -145,12 +144,12 @@ if (uap->flag & NFSSVC_ADDSOCK) { error = copyin(uap->argp, (caddr_t)&nfsdarg, sizeof(nfsdarg)); if (error) - goto done2; + return (error); if ((error = fget(td, nfsdarg.sock, &fp)) != 0) - goto done2; + return (error); if (fp->f_type != DTYPE_SOCKET) { fdrop(fp, td); - goto done2; + return (error); /* XXXRW: Should be EINVAL? */ } /* * Get the client address for connected sockets. @@ -162,7 +161,7 @@ nfsdarg.namelen); if (error) { fdrop(fp, td); - goto done2; + return (error); } } error = nfssvc_addsock(fp, nam, td); @@ -174,8 +173,6 @@ } if (error == EINTR || error == ERESTART) error = 0; -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -190,8 +187,6 @@ struct socket *so; int error, s; - NET_ASSERT_GIANT(); - so = fp->f_data; #if 0 /* @@ -305,8 +300,6 @@ int procrastinate; u_quad_t cur_usec; - NET_ASSERT_GIANT(); - #ifndef nolint cacherep = RC_DOIT; writes_todo = 0; @@ -590,7 +583,6 @@ struct nfsrv_rec *rec; int s; - NET_ASSERT_GIANT(); NFSD_LOCK_ASSERT(); /* @@ -703,7 +695,6 @@ { struct nfssvc_sock *slp, *nslp; - NET_ASSERT_GIANT(); NFSD_LOCK_ASSERT(); if (nfssvc_sockhead_flag & SLP_INIT) Index: pci/if_xl.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/pci/if_xl.c,v retrieving revision 1.209 diff -u -r1.209 if_xl.c --- pci/if_xl.c 23 Feb 2007 12:19:03 -0000 1.209 +++ pci/if_xl.c 29 Jul 2007 19:26:33 -0000 @@ -2102,12 +2102,10 @@ { struct xl_softc *sc = (struct xl_softc *)arg; - NET_LOCK_GIANT(); XL_LOCK(sc); if (sc->xl_ifp->if_drv_flags & IFF_DRV_RUNNING) xl_rxeof(sc); XL_UNLOCK(sc); - NET_UNLOCK_GIANT(); } /* Index: rpc/rpcclnt.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/rpc/rpcclnt.c,v retrieving revision 1.19 diff -u -r1.19 rpcclnt.c --- rpc/rpcclnt.c 16 Jun 2007 05:42:26 -0000 1.19 +++ rpc/rpcclnt.c 28 Jul 2007 13:39:49 -0000 @@ -365,11 +365,8 @@ saddr = rpc->rc_name; - NET_LOCK_GIANT(); error = socreate(saddr->sa_family, &rpc->rc_so, rpc->rc_sotype, rpc->rc_soproto, td->td_ucred, td); - NET_UNLOCK_GIANT(); - if (error) { RPCDEBUG("error %d in socreate()", error); RPC_RETURN(error); @@ -627,10 +624,8 @@ if (rpc->rc_so) { so = rpc->rc_so; rpc->rc_so = NULL; - NET_LOCK_GIANT(); soshutdown(so, 2); soclose(so); - NET_UNLOCK_GIANT(); } } @@ -708,10 +703,7 @@ * to be conditionally acquired earlier for the stack so has to avoid * lock order reversals with any locks held over rpcclnt_send(). */ - NET_LOCK_GIANT(); error = sosend(so, sendnam, NULL, top, NULL, flags, td); - NET_UNLOCK_GIANT(); - if (error) { if (rep) { log(LOG_INFO, "rpc send error %d for service %s\n", error, @@ -838,9 +830,7 @@ #endif do { rcvflg = MSG_WAITALL; - NET_LOCK_GIANT(); error = soreceive(so, NULL, &auio, NULL, NULL, &rcvflg); - NET_UNLOCK_GIANT(); if (error == EWOULDBLOCK && rep) { if (rep->r_flags & R_SOFTTERM) RPC_RETURN(EINTR); @@ -873,9 +863,7 @@ auio.uio_resid = len; do { rcvflg = MSG_WAITALL; - NET_LOCK_GIANT(); error = soreceive(so, NULL, &auio, mp, NULL, &rcvflg); - NET_UNLOCK_GIANT(); } while (error == EWOULDBLOCK || error == EINTR || error == ERESTART); if (!error && auio.uio_resid > 0) { @@ -901,9 +889,7 @@ #endif do { rcvflg = 0; - NET_LOCK_GIANT(); error = soreceive(so, NULL, &auio, mp, &control, &rcvflg); - NET_UNLOCK_GIANT(); if (control) m_freem(control); if (error == EWOULDBLOCK && rep) { @@ -949,9 +935,7 @@ do { rcvflg = 0; - NET_LOCK_GIANT(); error = soreceive(so, getnam, &auio, mp, NULL, &rcvflg); - NET_UNLOCK_GIANT(); RPCDEBUG("soreceive returns %d", error); if (error == EWOULDBLOCK && (rep->r_flags & R_SOFTTERM)) { RPCDEBUG("wouldblock && softerm -> EINTR"); Index: security/mac/mac_syscalls.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/security/mac/mac_syscalls.c,v retrieving revision 1.131 diff -u -r1.131 mac_syscalls.c --- security/mac/mac_syscalls.c 4 Mar 2007 22:36:48 -0000 1.131 +++ security/mac/mac_syscalls.c 29 Jul 2007 19:25:50 -0000 @@ -278,11 +278,9 @@ case DTYPE_SOCKET: so = fp->f_data; intlabel = mac_socket_label_alloc(M_WAITOK); - NET_LOCK_GIANT(); SOCK_LOCK(so); mac_copy_socket_label(so->so_label, intlabel); SOCK_UNLOCK(so); - NET_UNLOCK_GIANT(); error = mac_externalize_socket_label(intlabel, elements, buffer, mac.m_buflen); mac_socket_label_free(intlabel); @@ -476,10 +474,8 @@ error = mac_internalize_socket_label(intlabel, buffer); if (error == 0) { so = fp->f_data; - NET_LOCK_GIANT(); error = mac_socket_label_set(td->td_ucred, so, intlabel); - NET_UNLOCK_GIANT(); } mac_socket_label_free(intlabel); break; Index: sys/mutex.h =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/sys/mutex.h,v retrieving revision 1.100 diff -u -r1.100 mutex.h --- sys/mutex.h 28 Jul 2007 07:31:30 -0000 1.100 +++ sys/mutex.h 29 Jul 2007 19:26:47 -0000 @@ -396,19 +396,6 @@ return (_val); \ } while (0) -/* - * With the advent of fine-grained locking, the Giant lock is no longer - * required around the network stack. These macros exist for historical - * reasons, allowing conditional acquisition of Giant based on a debugging - * setting, and will be removed. - */ -#define NET_LOCK_GIANT() do { \ -} while (0) -#define NET_UNLOCK_GIANT() do { \ -} while (0) -#define NET_ASSERT_GIANT() do { \ -} while (0) - struct mtx_args { struct mtx *ma_mtx; const char *ma_desc;