From 93429f2778c1eefb93458add0ccaaa0b4e7dc6dc Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 23 Oct 2004 20:49:17 +0000 Subject: Add a new per-thread private flag: TDP_GEOM. This flag gets set whenever the thread posts an event on the GEOM event queue, and if the flag is set when the thread is prepared to return to userland from the kernel, g_waitidle() will be called to make sure that the posted events have completed. This can replace an insufficient number of g_waitidle() calls in various other places, and has the advantage of being failsafe: Any system call which does a VOP_OPEN()/VOP_CLOSE will now correctly wait for any geom events it posted as part of spoils or tastes. Assert that topology and Giant is not held in g_waitidle(). --- sys/kern/subr_trap.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sys/kern/subr_trap.c') diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 86026a4..89fab49 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -95,6 +95,13 @@ userret(td, frame, oticks) #endif /* + * If this thread tickled GEOM, we need to wait for the giggling to + * stop before we return to userland + */ + if (td->td_pflags & TDP_GEOM) + g_waitidle(); + + /* * Let the scheduler adjust our priority etc. */ sched_userret(td); -- cgit v1.1