Rick Macklem <[email protected]> wrote in <476361430.1773817.1329954835308.javamail.r...@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> > > > > [email protected]:/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
pgphnvwzNb6TV.pgp
Description: PGP signature
