Preventing deadlocks on the event queue.

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Jan 26 08:15:41 PST 2004


In message <20040126161300.GJ565 at 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 at 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.


More information about the freebsd-geom mailing list