Date: Thu, 06 Mar 2003 15:02:07 -0500 (EST) From: John Baldwin <jhb@FreeBSD.org> To: Jonathan Lemon <jlemon@flugsvamp.com> Cc: current@FreeBSD.org, jeffr@FreeBSD.org Subject: Re: witness: nfs & buf queue Message-ID: <XFMail.20030306150207.jhb@FreeBSD.org> In-Reply-To: <20030306132220.T61787@flugsvamp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 06-Mar-2003 Jonathan Lemon wrote:
> On Thu, Mar 06, 2003 at 01:01:49PM -0500, John Baldwin wrote:
>>
>> On 06-Mar-2003 Jonathan Lemon wrote:
>> > Doing a kernel build over NFS on today's -current gives a pile of
>> > following error messages during the final link phase:
>> >
>> > Acquiring lockmgr lock "nfs" with the following non-sleepablelocks held:
>> > exclusive sleep mutex buf queue lock r = 0 (0xc0427b60) locked @ ../../../kern/vfs_bio.c:2107
>> > Acquiring lockmgr lock "nfs" with the following non-sleepablelocks held:
>> > exclusive sleep mutex buf queue lock r = 0 (0xc0427b60) locked @ ../../../kern/vfs_bio.c:2107
>> > Acquiring lockmgr lock "nfs" with the following non-sleepablelocks held:
>> > exclusive sleep mutex buf queue lock r = 0 (0xc0427b60) locked @ ../../../kern/vfs_bio.c:2107
>> > ...
>>
>> Witness didn't used to complain about these until my recent commits,
>> so these could be old bugs that we are just now seeing. It does look
>> like all the lock functions in inmem() use LK_NOWAIT which is exempted
>> from the witness check:
>>
>> if ((flags & (LK_NOWAIT|LK_RELEASE)) == 0)
>> WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK,
>> &lkp->lk_interlock->mtx_object,
>> "Acquiring lockmgr lock \"%s\"", lkp->lk_wmesg);
>>
>> A stack trace from one of these would be helpful.
>
> Here you go. This is from -current as of roughly an hour ago, I managed
> to break into ddb in the middle of witness_warn:
>
> kvprintf(c03918eb,c0210c20,e4050bfc,a,e4050c48) at kvprintf+0x8d
> vprintf(c03918eb,e4050c48,0,c0428620,10001) at vprintf+0x57
> witness_warn(5,c0400da8,c03918eb,c039fff9,c6a752d0) at witness_warn+0xbe
> lockmgr(ca438304,10001,ca438248,c6a752d0,12) at lockmgr+0xc8
10001 = LK_INTERLOCK | LK_SHARED, note no LK_NOWAIT flag, hence the bug. :(
> vop_sharedlock(e4050c98,0,c039a8b0,35c,c01eb1f2) at vop_sharedlock+0x7d
The bug seems to be that vop_sharedlock doesn't honor LK_NOWAIT or any
other external lockmgr flags.
Untested possible patch below. I'd really like jeffr's comments on it
though:
Index: vfs_default.c
===================================================================
RCS file: /usr/cvs/src/sys/kern/vfs_default.c,v
retrieving revision 1.75
diff -u -r1.75 vfs_default.c
--- vfs_default.c 3 Mar 2003 23:37:50 -0000 1.75
+++ vfs_default.c 6 Mar 2003 20:00:40 -0000
@@ -445,8 +445,7 @@
default:
panic("vop_sharedlock: bad operation %d", flags & LK_TYPE_MASK);
}
- if (flags & LK_INTERLOCK)
- vnflags |= LK_INTERLOCK;
+ vnflags |= flags & (LK_INTERLOCK | LK_EXTFLG_MASK);
#ifndef DEBUG_LOCKS
return (lockmgr(vp->v_vnlock, vnflags, VI_MTX(vp), ap->a_td));
#else
@@ -503,8 +502,7 @@
default:
panic("vop_nolock: bad operation %d", flags & LK_TYPE_MASK);
}
- if (flags & LK_INTERLOCK)
- vnflags |= LK_INTERLOCK;
+ vnflags |= flags & (LK_INTERLOCK | LK_EXTFLG_MASK);
return(lockmgr(vp->v_vnlock, vnflags, VI_MTX(vp), ap->a_td));
#else /* for now */
/*
--
John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030306150207.jhb>
