PERFORCE change 43979 for review

Sam Leffler sam at FreeBSD.org
Tue Dec 16 11:12:19 PST 2003


http://perforce.freebsd.org/chv.cgi?CH=43979

Change 43979 by sam at sam_ebb on 2003/12/16 11:11:23

	add some locking missed in my first pass merging from bsd/os

Affected files ...

.. //depot/projects/netperf+sockets/sys/netinet/tcp_input.c#3 edit
.. //depot/projects/netperf+sockets/sys/nfsclient/nfs_socket.c#4 edit

Differences ...

==== //depot/projects/netperf+sockets/sys/netinet/tcp_input.c#3 (text+ko) ====

@@ -1039,6 +1039,7 @@
 				acked = th->th_ack - tp->snd_una;
 				tcpstat.tcps_rcvackpack++;
 				tcpstat.tcps_rcvackbyte += acked;
+				SOCKBUF_LOCK(&so->so_snd);
 				sbdrop(&so->so_snd, acked);
 				if (SEQ_GT(tp->snd_una, tp->snd_recover) &&
 				    SEQ_LEQ(th->th_ack, tp->snd_recover))
@@ -1076,7 +1077,8 @@
 						      tp->t_rxtcur,
 						      tcp_timer_rexmt, tp);
 
-				sowwakeup(so);
+				sowwakeup_locked(so);
+				SOCKBUF_UNLOCK(&so->so_snd);
 				if (so->so_snd.sb_cc)
 					(void) tcp_output(tp);
 				goto check_delack;
@@ -1964,6 +1966,7 @@
 				incr = incr * incr / cw;
 			tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<<tp->snd_scale);
 		}
+		SOCKBUF_LOCK(&so->so_snd);
 		if (acked > so->so_snd.sb_cc) {
 			tp->snd_wnd -= so->so_snd.sb_cc;
 			sbdrop(&so->so_snd, (int)so->so_snd.sb_cc);
@@ -1973,7 +1976,8 @@
 			tp->snd_wnd -= acked;
 			ourfinisacked = 0;
 		}
-		sowwakeup(so);
+		sowwakeup_locked(so);
+		SOCKBUF_UNLOCK(&so->so_snd);
 		/* detect una wraparound */
 		if (tcp_do_newreno && !IN_FASTRECOVERY(tp) &&
 		    SEQ_GT(tp->snd_una, tp->snd_recover) &&

==== //depot/projects/netperf+sockets/sys/nfsclient/nfs_socket.c#4 (text+ko) ====

@@ -160,7 +160,7 @@
 nfs_connect(struct nfsmount *nmp, struct nfsreq *rep)
 {
 	struct socket *so;
-	int s, error, rcvreserve, sndreserve;
+	int error, rcvreserve, sndreserve;
 	int pktscale;
 	struct sockaddr *saddr;
 	struct thread *td = &thread0; /* only used for socreate and sobind */
@@ -243,25 +243,25 @@
 		 * connect system call but with the wait timing out so
 		 * that interruptible mounts don't hang here for a long time.
 		 */
-		s = splnet();
+		SOCK_LOCK(so);
 		while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
-			(void) tsleep(&so->so_timeo,
+			(void) msleep(&so->so_timeo, SOCK_MTX(so),
 			    PSOCK, "nfscon", 2 * hz);
 			if ((so->so_state & SS_ISCONNECTING) &&
 			    so->so_error == 0 && rep &&
 			    (error = nfs_sigintr(nmp, rep, rep->r_td)) != 0) {
 				so->so_state &= ~SS_ISCONNECTING;
-				splx(s);
+				SOCK_UNLOCK(so);
 				goto bad;
 			}
 		}
 		if (so->so_error) {
 			error = so->so_error;
 			so->so_error = 0;
-			splx(s);
+			SOCK_UNLOCK(so);
 			goto bad;
 		}
-		splx(s);
+		SOCK_UNLOCK(so);
 	}
 	so->so_rcv.sb_timeo = 5 * hz;
 	so->so_snd.sb_timeo = 5 * hz;


More information about the p4-projects mailing list