diff --git a/sys/geom/geom.h b/sys/geom/geom.h index a9990f66986..fa7cacc25f5 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -59,6 +59,7 @@ struct sbuf; struct gctl_req; struct g_configargs; struct disk_zone_args; +struct thread; typedef int g_config_t (struct g_configargs *ca); typedef void g_ctl_req_t (struct gctl_req *, struct g_class *cp, char const *verb); @@ -270,6 +271,7 @@ int g_media_gone(struct g_provider *pp, int flag); void g_orphan_provider(struct g_provider *pp, int error); struct g_event *g_alloc_event(int flag); void g_post_event_ep(g_event_t *func, void *arg, struct g_event *ep, ...); +void g_waitidle(struct thread *td); /* 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 f14dfbe1cb5..824fe336fe1 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -81,7 +81,7 @@ struct g_event { #define EV_INPROGRESS 0x10000 void -g_waitidle(void) +g_waitidle(struct thread *td) { g_topology_assert_not(); @@ -93,17 +93,17 @@ g_waitidle(void) "g_waitidle", 0); TSUNWAIT("GEOM events"); mtx_unlock(&g_eventlock); - curthread->td_pflags &= ~TDP_GEOM; + td->td_pflags &= ~TDP_GEOM; } static void -ast_geom(struct thread *td __unused, int tda __unused) +ast_geom(struct thread *td, int tda __unused) { /* * If this thread tickled GEOM, we need to wait for the giggling to * stop before we return to userland. */ - g_waitidle(); + g_waitidle(td); } static void diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c index ddc9784109b..1cf5efb6e57 100644 --- a/sys/kern/vfs_mountroot.c +++ b/sys/kern/vfs_mountroot.c @@ -978,6 +978,7 @@ static void vfs_mountroot_wait(void) { struct root_hold_token *h; + struct thread *td; struct timeval lastfail; int curfail; @@ -986,8 +987,9 @@ vfs_mountroot_wait(void) curfail = 0; lastfail.tv_sec = 0; ppsratecheck(&lastfail, &curfail, 1); + td = curthread; while (1) { - g_waitidle(); + g_waitidle(td); mtx_lock(&root_holds_mtx); if (TAILQ_EMPTY(&root_holds)) { mtx_unlock(&root_holds_mtx); @@ -1004,7 +1006,7 @@ vfs_mountroot_wait(void) hz); TSUNWAIT("root mount"); } - g_waitidle(); + g_waitidle(td); TSEXIT(); } @@ -1030,7 +1032,7 @@ vfs_mountroot_wait_if_neccessary(const char *fs, const char *dev) * Note that we must wait for GEOM to finish reconfiguring itself, * eg for geom_part(4) to finish tasting. */ - g_waitidle(); + g_waitidle(curthread); if (parse_mount_dev_present(dev)) return (0); diff --git a/sys/sys/systm.h b/sys/sys/systm.h index e4d7a949945..52ee592e9e4 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -150,7 +150,6 @@ void *hashinit_flags(int count, struct malloc_type *type, void *phashinit(int count, struct malloc_type *type, u_long *nentries); void *phashinit_flags(int count, struct malloc_type *type, u_long *nentries, int flags); -void g_waitidle(void); void cpu_flush_dcache(void *, size_t); void cpu_rootconf(void);