From owner-freebsd-current Wed Apr 3 9:11:13 2002 Delivered-To: freebsd-current@freebsd.org Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by hub.freebsd.org (Postfix) with ESMTP id 2F2D537B419 for ; Wed, 3 Apr 2002 09:11:06 -0800 (PST) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.12.2/8.12.2) with ESMTP id g33HB5Cc037664; Wed, 3 Apr 2002 09:11:05 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.12.2/8.12.2/Submit) id g33HB5rZ037663; Wed, 3 Apr 2002 09:11:05 -0800 (PST) Date: Wed, 3 Apr 2002 09:11:05 -0800 From: Steve Kargl To: Jonathan Mini Cc: "Steven G. Kargl" , freebsd-current@FreeBSD.ORG Subject: Re: two lock order reversals Message-ID: <20020403091105.A37639@troutmask.apl.washington.edu> References: <200204030111.g331BDCP033703@troutmask.apl.washington.edu> <20020402182540.B80692@stylus.haikugeek.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020402182540.B80692@stylus.haikugeek.com>; from mini@haikugeek.com on Tue, Apr 02, 2002 at 06:25:40PM -0800 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 I apparently responded to Jonathan via private email. The patch below fixes the eventhandler lock ordering problem. steve On Tue, Apr 02, 2002 at 06:25:40PM -0800, Jonathan Mini wrote: > Steven G. Kargl [kargl@troutmask.apl.washington.edu] wrote : > >> lock order reversal >> 1st 0xc02d9b40 eventhandler @ /usr/src/sys/kern/subr_eventhandler.c:163 >> 2nd 0xc4050008 shutdown_post_sync @ /usr/src/sys/kern/subr_eventhandler.c:116 > > [ ... ] > >> I believe the second is known, but the first appears >> to be related to the recent eventhandler locking. > > Sorry about that. > > Index: kern/subr_eventhandler.c > =================================================================== > RCS file: /usr/cvs/src/sys/kern/subr_eventhandler.c,v > retrieving revision 1.16 > diff -u -r1.16 subr_eventhandler.c > --- sys/kern/subr_eventhandler.c 2 Apr 2002 04:18:54 -0000 1.16 > +++ sys/kern/subr_eventhandler.c 3 Apr 2002 02:21:29 -0000 > @@ -101,11 +101,11 @@ > sx_init(&list->el_lock, name); > list->el_flags = EHE_INITTED; > } > + mtx_unlock(&eventhandler_mutex); > > /* allocate an entry for this handler, populate it */ > if ((eg = malloc(sizeof(struct eventhandler_entry_generic), > M_EVENTHANDLER, M_NOWAIT)) == NULL) { > - mtx_unlock(&eventhandler_mutex); > return(NULL); > } > eg->func = func; > @@ -125,7 +125,6 @@ > if (ep == NULL) > TAILQ_INSERT_TAIL(&list->el_entries, &eg->ee, ee_link); > EHE_UNLOCK(list); > - mtx_unlock(&eventhandler_mutex); > return(&eg->ee); > } > > > -- > Jonathan Mini > mini@haikugeek.com > > desolation... despair... plastic forks... > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message -- Steve To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message