From owner-freebsd-geom@FreeBSD.ORG Mon Jan 26 08:15:41 2004 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 804DD16A4CE for ; Mon, 26 Jan 2004 08:15:41 -0800 (PST) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id E0AA843D31 for ; Mon, 26 Jan 2004 08:15:39 -0800 (PST) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.10/8.12.10) with ESMTP id i0QGFbuO066985; Mon, 26 Jan 2004 17:15:37 +0100 (CET) (envelope-from phk@phk.freebsd.dk) To: Pawel Jakub Dawidek From: "Poul-Henning Kamp" In-Reply-To: Your message of "Mon, 26 Jan 2004 17:13:00 +0100." <20040126161300.GJ565@garage.freebsd.pl> Date: Mon, 26 Jan 2004 17:15:37 +0100 Message-ID: <66984.1075133737@critter.freebsd.dk> cc: freebsd-geom@freebsd.org cc: Lukas Ertl Subject: Re: Preventing deadlocks on the event queue. X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2004 16:15:41 -0000 In message <20040126161300.GJ565@garage.freebsd.pl>, Pawel Jakub Dawidek writes >On Mon, Jan 26, 2004 at 04:50:38PM +0100, Lukas Ertl wrote: >+> > So, I think I've found clever way to prevents deadlock caused by >+> > calling g_waitfor_event() from an event. >+> > >+> > My idea is to check if curthread in g_waitfor_event() is a g_event thr= >ead. >+> > >+> > http://garage.freebsd.pl/patches/geom_event_deadlock.patch >+>=20 >+> Do you really want to make this a separate function? Since it's just a >+> one-line comparison, wouldn't a macro suffice? > >I want to avoid exporting 'g_event_proc' from geom_kern.c (it is declareted >staticaly there). Right, g_event_proc should stay local to geom_kern.c if at all possible. I'm still trying to see if I can find a more elegant way to do it, but curproc/curthread is probably the trick. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.