summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-10-23 20:49:17 +0000
committerphk <phk@FreeBSD.org>2004-10-23 20:49:17 +0000
commit93429f2778c1eefb93458add0ccaaa0b4e7dc6dc (patch)
tree1ae80df1885403ab58d62d12a9d391c55a499ee5 /sys/kern/subr_trap.c
parent00ae1b0f027fae923a5fc5b6ad862dcb3dcd2384 (diff)
downloadFreeBSD-src-93429f2778c1eefb93458add0ccaaa0b4e7dc6dc.zip
FreeBSD-src-93429f2778c1eefb93458add0ccaaa0b4e7dc6dc.tar.gz
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().
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c7
1 files changed, 7 insertions, 0 deletions
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);
OpenPOWER on IntegriCloud