From owner-freebsd-stable@FreeBSD.ORG Thu Feb 23 00:04:24 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 4DE16106564A; Thu, 23 Feb 2012 00:04:24 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id E1B7C8FC08; Thu, 23 Feb 2012 00:04:23 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap8EAIeBRU+DaFvO/2dsb2JhbABEFoUeriuBcwEBBAEjBFIFFg4KAgINGQJZBhOIAQmsTootgS+MAgECBAsDDw0CBRINBQMChE6BHQoPgiKBFgSIT4xpkws X-IronPort-AV: E=Sophos;i="4.73,466,1325480400"; d="scan'208";a="160594858" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 22 Feb 2012 19:04:22 -0500 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id E8FEDB3F0F; Wed, 22 Feb 2012 19:04:22 -0500 (EST) Date: Wed, 22 Feb 2012 19:04:22 -0500 (EST) From: Rick Macklem To: Konstantin Belousov Message-ID: <780341943.1774154.1329955462926.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20120222192414.GU55074@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.202] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Win)/6.0.10_GA_2692) Cc: stable@freebsd.org, John Baldwin 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 00:04:24 -0000 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. > Yes. > Anyway, you should use consistent outer lock for the same wchan, i.e. > no lock (tsleep) or mtx (msleep), but not mix them. > > > > 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 ? It appears jhb@ figured out the typo. I meant to type mtx_sleep(), not mtx_lock(). rick