diff --git a/sys/geom/geom.h b/sys/geom/geom.h index ffdc3cbf8a2f..3ae296b935e9 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -213,6 +213,7 @@ int g_post_event(g_event_t *func, void *arg, int flag, ...); int g_waitfor_event(g_event_t *func, void *arg, int flag, ...); void g_cancel_event(void *ref); void g_orphan_provider(struct g_provider *pp, int error); +void g_waitidlelock(void); /* geom_subr.c */ int g_access(struct g_consumer *cp, int nread, int nwrite, int nexcl); diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index 9166c30c9217..f550efc63a52 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -89,6 +89,18 @@ g_waitidle(void) curthread->td_pflags &= ~TDP_GEOM; } +void +g_waitidlelock(void) +{ + + g_topology_assert(); + while (g_pending_events) { + g_topology_unlock(); + tsleep(&g_pending_events, PPAUSE, "g_waitidle", hz/5); + g_topology_lock(); + } +} + void g_orphan_provider(struct g_provider *pp, int error) {