From owner-freebsd-current Thu Mar 6 12: 1:59 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 03BBE37B401 for ; Thu, 6 Mar 2003 12:01:57 -0800 (PST) Received: from mail.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id D7C2743FBF for ; Thu, 6 Mar 2003 12:01:55 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 18880 invoked from network); 6 Mar 2003 20:02:01 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail12.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 6 Mar 2003 20:02:01 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.6/8.12.6) with ESMTP id h26Jx3hT052448; Thu, 6 Mar 2003 14:59:03 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20030306132220.T61787@flugsvamp.com> Date: Thu, 06 Mar 2003 15:02:07 -0500 (EST) From: John Baldwin To: Jonathan Lemon Subject: Re: witness: nfs & buf queue Cc: current@FreeBSD.org, jeffr@FreeBSD.org Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 <>< 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