diff options
author | le <le@FreeBSD.org> | 2005-01-19 14:08:16 +0000 |
---|---|---|
committer | le <le@FreeBSD.org> | 2005-01-19 14:08:16 +0000 |
commit | 8c1fee0f75460377513bcc9c1d6951b094b1cad7 (patch) | |
tree | df8941674d961d7e087d9ac79802c3b433088287 /sys/geom/vinum | |
parent | eb12fefc3570c56802a22267d21da4b936c064b6 (diff) | |
download | FreeBSD-src-8c1fee0f75460377513bcc9c1d6951b094b1cad7.zip FreeBSD-src-8c1fee0f75460377513bcc9c1d6951b094b1cad7.tar.gz |
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.
Diffstat (limited to 'sys/geom/vinum')
-rw-r--r-- | sys/geom/vinum/geom_vinum_drive.c | 14 | ||||
-rw-r--r-- | sys/geom/vinum/geom_vinum_plex.c | 11 | ||||
-rw-r--r-- | sys/geom/vinum/geom_vinum_volume.c | 12 |
3 files changed, 32 insertions, 5 deletions
diff --git a/sys/geom/vinum/geom_vinum_drive.c b/sys/geom/vinum/geom_vinum_drive.c index 244e169..279d569 100644 --- a/sys/geom/vinum/geom_vinum_drive.c +++ b/sys/geom/vinum/geom_vinum_drive.c @@ -535,13 +535,21 @@ gv_drive_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) d->freelist_entries = 1; TAILQ_INIT(&d->bqueue); + + /* 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; - - /* Save it into the main configuration. */ - LIST_INSERT_HEAD(&sc->drives, d, drive); } g_access(cp, -1, 0, 0); diff --git a/sys/geom/vinum/geom_vinum_plex.c b/sys/geom/vinum/geom_vinum_plex.c index 8fa2923..5e8aafb 100644 --- a/sys/geom/vinum/geom_vinum_plex.c +++ b/sys/geom/vinum/geom_vinum_plex.c @@ -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. */ diff --git a/sys/geom/vinum/geom_vinum_volume.c b/sys/geom/vinum/geom_vinum_volume.c index 4ace9d2..307cfa8 100644 --- a/sys/geom/vinum/geom_vinum_volume.c +++ b/sys/geom/vinum/geom_vinum_volume.c @@ -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 |