From owner-freebsd-stable@FreeBSD.ORG Wed Feb 22 21:35:13 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 2A6DE1065677; Wed, 22 Feb 2012 21:35:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 007788FC14; Wed, 22 Feb 2012 21:35:13 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id ACC3846B09; Wed, 22 Feb 2012 16:35:12 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 1CAB9B9A7; Wed, 22 Feb 2012 16:35:12 -0500 (EST) From: John Baldwin To: Konstantin Belousov Date: Wed, 22 Feb 2012 16:33:02 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <20120222.233814.1255848524636250830.hrs@allbsd.org> <810873252.1742743.1329928180108.JavaMail.root@erie.cs.uoguelph.ca> <20120222192414.GU55074@deviant.kiev.zoral.com.ua> In-Reply-To: <20120222192414.GU55074@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201202221633.02170.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 22 Feb 2012 16:35:12 -0500 (EST) Cc: stable@freebsd.org, Rick Macklem 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: Wed, 22 Feb 2012 21:35:13 -0000 On Wednesday, February 22, 2012 2:24:14 pm Konstantin Belousov wrote: > On Wed, Feb 22, 2012 at 11:29:40AM -0500, Rick Macklem wrote: > > Hiroki Sato wrote: > > > Hi, > > > > > > Just a report, but I got the following panic on an NFS server running > > > 8.3-PRERELEASE: > > > > > > ----(from here)---- > > > pool.allbsd.org dumped core - see /var/crash/vmcore.0 > > > > > > Tue Feb 21 10:59:44 JST 2012 > > > > > > FreeBSD pool.allbsd.org 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #7: Thu > > > Feb 16 19:29:19 JST 2012 hrs@pool.allbsd.org:/usr/obj/usr/src/sys/POOL > > > amd64 > > > > > > panic: Assertion lock == sq->sq_lock failed at > > > /usr/src/sys/kern/subr_sleepqueue.c:335 > > > > > Oops, I didn't know that mixing msleep() and tsleep() calls on the same > > event wasn't allowed. > > There are two places in the code where it did a: > > mtx_unlock(); > > tsleep(); > > left over from the days when it was written for OpenBSD. > This sequence allows to lost the wakeup which is happen right after > cache unlock (together with clearing the RC_WANTED flag) but before > the thread enters sleep state. The tsleep has a timeout so thread should > recover in 10 seconds, but still. > > Anyway, you should use consistent outer lock for the same wchan, i.e. > no lock (tsleep) or mtx (msleep), but not mix them. Correct. > > I don't think the mix would actually break anything, except that the > > MPASS() assertion fails, but I've cc'd jhb@ since he seems to have been > > the author of the sleep() stuff. > > > > Anyhow, please try the attached patch which replaces the mtx_unlock(); tsleep(); with > > msleep()s using PDROP. If the attachment gets lost, the patch is also here: > > http://people.freebsd.org/~rmacklem/tsleep.patch > > > > Thanks for reporting this, rick > > ps: Is mtx_lock() now preferred over msleep()? > What do you mean ? mtx_sleep() is preferred over msleep(), but I doubt I will remove msleep() anytime soon. -- John Baldwin