From owner-freebsd-current@FreeBSD.ORG Wed Dec 22 08:58:41 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8FE0116A4CE; Wed, 22 Dec 2004 08:58:41 +0000 (GMT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A13443D3F; Wed, 22 Dec 2004 08:58:41 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (localhost [127.0.0.1]) by fledge.watson.org (8.13.1/8.13.1) with ESMTP id iBM8tWZe072467; Wed, 22 Dec 2004 03:55:32 -0500 (EST) (envelope-from robert@fledge.watson.org) Received: from localhost (robert@localhost)iBM8tWGq072464; Wed, 22 Dec 2004 08:55:32 GMT (envelope-from robert@fledge.watson.org) Date: Wed, 22 Dec 2004 08:55:31 +0000 (GMT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Alan Cox In-Reply-To: <20041220201953.GI1362@cs.rice.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@freebsd.org Subject: Re: panic: sbflush_locked X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Dec 2004 08:58:41 -0000 On Mon, 20 Dec 2004, Alan Cox wrote: > > I haven't seen this in a very long time, but I've definitely tried to > > track it down before with zero luck. > > With the attached change, I've had no more crashes. > > I speculate uipc_send() is missing needed synchronization on so_snd. > Robert, can you verify the patch? Sorry for the delay in responding to your original post; I'm still catching up with e-mail from my trip to Bangladesh. I actually had similar changes to this in the netperf branch at one point, but think I removed them due to concerns about lock order. However, this change is careful to acquire the send lock before the receive lock, so I think shouldn't present a problem from that perspective. Please go ahead and commit, perhaps with a 2 week MFC time? Thanks! Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Principal Research Scientist, McAfee Research > Index: kern/uipc_usrreq.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/uipc_usrreq.c,v > retrieving revision 1.143 > diff -u -r1.143 uipc_usrreq.c > --- kern/uipc_usrreq.c 1 Dec 2004 09:22:26 -0000 1.143 > +++ kern/uipc_usrreq.c 19 Dec 2004 03:22:50 -0000 > @@ -452,7 +452,9 @@ > } > } > > + SOCKBUF_LOCK(&so->so_snd); > if (so->so_snd.sb_state & SBS_CANTSENDMORE) { > + SOCKBUF_UNLOCK(&so->so_snd); > error = EPIPE; > break; > } > @@ -478,6 +480,7 @@ > (so2->so_rcv.sb_cc - unp->unp_conn->unp_cc); > (void)chgsbsize(so->so_cred->cr_uidinfo, &so->so_snd.sb_hiwat, > newhiwat, RLIM_INFINITY); > + SOCKBUF_UNLOCK(&so->so_snd); > unp->unp_conn->unp_cc = so2->so_rcv.sb_cc; > sorwakeup_locked(so2); > m = NULL;