Although an object may already be known in the configuration, it's
worker thread may have been destroyed (e.g. during orphaning). Make sure that objects get back their worker threads when they get a new geom.
This commit is contained in:
parent
3b6cdf438a
commit
f11c507c45
@ -535,15 +535,23 @@ gv_drive_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
|
||||
d->freelist_entries = 1;
|
||||
|
||||
TAILQ_INIT(&d->bqueue);
|
||||
mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF);
|
||||
kthread_create(gv_drive_worker, d, NULL, 0, 0,
|
||||
"gv_d %s", d->name);
|
||||
d->flags |= GV_DRIVE_THREAD_ACTIVE;
|
||||
|
||||
/* Save it into the main configuration. */
|
||||
LIST_INSERT_HEAD(&sc->drives, d, drive);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a bio queue mutex and a worker thread, if necessary.
|
||||
*/
|
||||
if (mtx_initialized(&d->bqueue_mtx) == 0)
|
||||
mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF);
|
||||
|
||||
if (!(d->flags & GV_DRIVE_THREAD_ACTIVE)) {
|
||||
kthread_create(gv_drive_worker, d, NULL, 0, 0,
|
||||
"gv_d %s", d->name);
|
||||
d->flags |= GV_DRIVE_THREAD_ACTIVE;
|
||||
}
|
||||
|
||||
g_access(cp, -1, 0, 0);
|
||||
|
||||
gp->softc = d;
|
||||
|
@ -773,6 +773,17 @@ gv_plex_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
|
||||
if (p->vol_sc != NULL)
|
||||
gv_update_vol_size(p->vol_sc, p->size);
|
||||
|
||||
/*
|
||||
* If necessary, create a bio queue mutex and a worker thread.
|
||||
*/
|
||||
if (mtx_initialized(&p->bqueue_mtx) == 0)
|
||||
mtx_init(&p->bqueue_mtx, "gv_plex", NULL, MTX_DEF);
|
||||
if (!(p->flags & GV_PLEX_THREAD_ACTIVE)) {
|
||||
kthread_create(gv_plex_worker, p, NULL, 0, 0, "gv_p %s",
|
||||
p->name);
|
||||
p->flags |= GV_PLEX_THREAD_ACTIVE;
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
|
||||
/* We need to create a new geom. */
|
||||
|
@ -314,6 +314,8 @@ gv_volume_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
|
||||
|
||||
first = 0;
|
||||
p = gp->softc;
|
||||
|
||||
/* Let's see if the volume this plex wants is already configured. */
|
||||
v = gv_find_vol(sc, p->volume);
|
||||
if (v == NULL)
|
||||
return (NULL);
|
||||
@ -325,12 +327,18 @@ gv_volume_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
|
||||
gp->softc = v;
|
||||
first++;
|
||||
TAILQ_INIT(&v->bqueue);
|
||||
} else
|
||||
gp = v->geom;
|
||||
|
||||
/* Create bio queue mutex and worker thread, if necessary. */
|
||||
if (mtx_initialized(&v->bqueue_mtx) == 0)
|
||||
mtx_init(&v->bqueue_mtx, "gv_plex", NULL, MTX_DEF);
|
||||
|
||||
if (!(v->flags & GV_VOL_THREAD_ACTIVE)) {
|
||||
kthread_create(gv_vol_worker, v, NULL, 0, 0, "gv_v %s",
|
||||
v->name);
|
||||
v->flags |= GV_VOL_THREAD_ACTIVE;
|
||||
} else
|
||||
gp = v->geom;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new consumer and attach it to the plex geom. Since this
|
||||
|
Loading…
Reference in New Issue
Block a user