PERFORCE change 43753 for review
Sam Leffler
sam at FreeBSD.org
Wed Dec 10 12:34:55 PST 2003
http://perforce.freebsd.org/chv.cgi?CH=43753
Change 43753 by sam at sam_ebb on 2003/12/10 12:34:18
strip spl's to indicate this code is properly locked
Affected files ...
.. //depot/projects/netperf+sockets/sys/kern/uipc_socket.c#5 edit
Differences ...
==== //depot/projects/netperf+sockets/sys/kern/uipc_socket.c#5 (text+ko) ====
@@ -531,7 +531,7 @@
struct mbuf **mp;
struct mbuf *m;
long space, len, resid;
- int clen = 0, error, s, dontroute, mlen;
+ int clen = 0, error, dontroute, mlen;
int atomic = sosendallatonce(so) || top;
#ifdef ZERO_COPY_SOCKETS
int cow_send;
@@ -563,20 +563,18 @@
td->td_proc->p_stats->p_ru.ru_msgsnd++;
if (control)
clen = control->m_len;
-#define snderr(errno) { error = (errno); splx(s); goto release; }
+#define snderr(errno) { error = (errno); goto release; }
SOCKBUF_LOCK(&so->so_snd);
error = sblock(&so->so_snd, SBLOCKWAIT(flags));
if (error)
goto out;
do {
- s = splnet();
if (so->so_state & SS_CANTSENDMORE)
snderr(EPIPE);
if (so->so_error) {
error = so->so_error;
so->so_error = 0;
- splx(s);
goto release;
}
if ((so->so_state & SS_ISCONNECTED) == 0) {
@@ -606,12 +604,10 @@
if (so->so_state & SS_NBIO)
snderr(EWOULDBLOCK);
error = sbwait(&so->so_snd);
- splx(s);
if (error)
goto release;
continue;
}
- splx(s);
mp = ⊤
space -= clen;
do {
@@ -705,13 +701,12 @@
} while (space > 0 && atomic);
if (dontroute)
so->so_options |= SO_DONTROUTE;
- s = splnet(); /* XXX */
/*
* XXX all the SS_CANTSENDMORE checks previously
* done could be out of date. We could have recieved
* a reset packet in an interrupt or maybe we slept
* while doing page faults in uiomove() etc. We could
- * probably recheck again inside the splnet() protection
+ * probably recheck again inside the locking protection
* here, but there are probably other places that this
* also happens. We must rethink this.
*/
@@ -729,7 +724,6 @@
/* If there is more to send set PRUS_MORETOCOME */
(resid > 0 && space > 0) ? PRUS_MORETOCOME : 0,
top, addr, control, td);
- splx(s);
if (dontroute)
so->so_options &= ~SO_DONTROUTE;
clen = 0;
@@ -778,7 +772,7 @@
int *flagsp;
{
struct mbuf *m, **mp;
- int flags, len, error, s, offset;
+ int flags, len, error, offset;
struct protosw *pr = so->so_proto;
struct mbuf *nextrecord;
int moff, type = 0;
@@ -840,7 +834,6 @@
error = sblock(&so->so_rcv, SBLOCKWAIT(flags));
if (error)
goto out;
- s = splnet();
restart:
m = so->so_rcv.sb_mb;
@@ -895,7 +888,6 @@
SBLASTRECORDCHK(&so->so_rcv);
SBLASTMBUFCHK(&so->so_rcv);
error = sbwait(&so->so_rcv);
- splx(s);
if (error)
goto out;
goto restart;
@@ -1000,7 +992,6 @@
if (mp == 0) {
SBLASTRECORDCHK(&so->so_rcv);
SBLASTMBUFCHK(&so->so_rcv);
- splx(s);
SOCKBUF_UNLOCK(&so->so_rcv);
#ifdef ZERO_COPY_SOCKETS
if (so_zero_copy_receive) {
@@ -1026,7 +1017,6 @@
#endif /* ZERO_COPY_SOCKETS */
error = uiomove(mtod(m, char *) + moff, (int)len, uio);
SOCKBUF_LOCK(&so->so_rcv);
- s = splnet();
if (error)
goto release;
} else
@@ -1143,7 +1133,6 @@
if (orig_resid == uio->uio_resid && orig_resid &&
(flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) {
sbunlock(&so->so_rcv);
- splx(s);
goto restart;
}
@@ -1151,7 +1140,6 @@
*flagsp |= flags;
release:
sbunlock(&so->so_rcv);
- splx(s);
out:
SOCKBUF_UNLOCK(&so->so_rcv);
return (error);
More information about the p4-projects
mailing list