From owner-freebsd-stable@FreeBSD.ORG Thu Feb 23 14:15:26 2012 Return-Path: Delivered-To: stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E65F01065674; Thu, 23 Feb 2012 14:15:25 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper-int.allbsd.org [IPv6:2001:2f0:104:e002::2]) by mx1.freebsd.org (Postfix) with ESMTP id 2BA748FC16; Thu, 23 Feb 2012 14:15:24 +0000 (UTC) Received: from alph.allbsd.org (p1012-ipbf2105funabasi.chiba.ocn.ne.jp [114.148.160.12]) (authenticated bits=128) by mail.allbsd.org (8.14.4/8.14.4) with ESMTP id q1NEF3Fu045867; Thu, 23 Feb 2012 23:15:13 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id q1NEF0Tp069073; Thu, 23 Feb 2012 23:15:02 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Thu, 23 Feb 2012 23:14:52 +0900 (JST) Message-Id: <20120223.231452.2197780863243078154.hrs@allbsd.org> To: rmacklem@uoguelph.ca From: Hiroki Sato In-Reply-To: <476361430.1773817.1329954835308.JavaMail.root@erie.cs.uoguelph.ca> References: <201202221633.02170.jhb@freebsd.org> <476361430.1773817.1329954835308.JavaMail.root@erie.cs.uoguelph.ca> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.4 on Emacs 23.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Thu_Feb_23_23_14_52_2012_010)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (mail.allbsd.org [133.31.130.32]); Thu, 23 Feb 2012 23:15:17 +0900 (JST) X-Spam-Status: No, score=-100.8 required=13.0 tests=BAYES_00, CONTENT_TYPE_PRESENT,RCVD_IN_PBL,RCVD_IN_RP_RNBL,SPF_SOFTFAIL, USER_IN_WHITELIST autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on gatekeeper.allbsd.org Cc: kostikbel@gmail.com, stable@FreeBSD.org, jhb@FreeBSD.org Subject: Re: panic in 8.3-PRERELEASE X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2012 14:15:26 -0000 ----Security_Multipart(Thu_Feb_23_23_14_52_2012_010)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Rick Macklem wrote in <476361430.1773817.1329954835308.JavaMail.root@erie.cs.uoguelph.ca>: rm> John Baldwin wrote: rm> > On Wednesday, February 22, 2012 2:24:14 pm Konstantin Belousov wrote: rm> > > On Wed, Feb 22, 2012 at 11:29:40AM -0500, Rick Macklem wrote: rm> > > > Hiroki Sato wrote: rm> > > > > Hi, rm> > > > > rm> > > > > Just a report, but I got the following panic on an NFS server rm> > > > > running rm> > > > > 8.3-PRERELEASE: rm> > > > > rm> > > > > ----(from here)---- rm> > > > > pool.allbsd.org dumped core - see /var/crash/vmcore.0 rm> > > > > rm> > > > > Tue Feb 21 10:59:44 JST 2012 rm> > > > > rm> > > > > FreeBSD pool.allbsd.org 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE rm> > > > > #7: Thu rm> > > > > Feb 16 19:29:19 JST 2012 rm> > > > > hrs@pool.allbsd.org:/usr/obj/usr/src/sys/POOL rm> > > > > amd64 rm> > > > > rm> > > > > panic: Assertion lock == sq->sq_lock failed at rm> > > > > /usr/src/sys/kern/subr_sleepqueue.c:335 rm> > > > > rm> > > > Oops, I didn't know that mixing msleep() and tsleep() calls on the rm> > > > same rm> > > > event wasn't allowed. rm> > > > There are two places in the code where it did a: rm> > > > mtx_unlock(); rm> > > > tsleep(); rm> > > > left over from the days when it was written for OpenBSD. rm> > > This sequence allows to lost the wakeup which is happen right after rm> > > cache unlock (together with clearing the RC_WANTED flag) but before rm> > > the thread enters sleep state. The tsleep has a timeout so thread rm> > > should rm> > > recover in 10 seconds, but still. rm> > > rm> > > Anyway, you should use consistent outer lock for the same wchan, rm> > > i.e. rm> > > no lock (tsleep) or mtx (msleep), but not mix them. rm> > rm> > Correct. rm> > rm> > > > I don't think the mix would actually break anything, except that rm> > > > the rm> > > > MPASS() assertion fails, but I've cc'd jhb@ since he seems to have rm> > > > been rm> > > > the author of the sleep() stuff. rm> > > > rm> > > > Anyhow, please try the attached patch which replaces the rm> > > > mtx_unlock(); rm> > tsleep(); with rm> > > > msleep()s using PDROP. If the attachment gets lost, the patch is rm> > > > also rm> > here: rm> > > > http://people.freebsd.org/~rmacklem/tsleep.patch rm> > > > rm> > > > Thanks for reporting this, rick rm> > > > ps: Is mtx_lock() now preferred over msleep()? rm> > > What do you mean ? rm> > rm> > mtx_sleep() is preferred over msleep(), but I doubt I will remove rm> > msleep() rm> > anytime soon. rm> > rm> Ok, I'll redo the patch with mtx_sleep() and get one of you guys to rm> review it. Thank you for the patch! I applied it and put the box under a stress testing again. -- Hiroki ----Security_Multipart(Thu_Feb_23_23_14_52_2012_010)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk9GSdwACgkQTyzT2CeTzy3WywCglyyNDeby0X3s1i551DJfB0Nj yjoAn2OzyCU3KdCK1b2ra/88RHXfhem2 =dUUz -----END PGP SIGNATURE----- ----Security_Multipart(Thu_Feb_23_23_14_52_2012_010)----