summaryrefslogtreecommitdiffstats
path: root/sys/geom/vinum/geom_vinum_drive.c
diff options
context:
space:
mode:
authorle <le@FreeBSD.org>2005-01-19 14:08:16 +0000
committerle <le@FreeBSD.org>2005-01-19 14:08:16 +0000
commit8c1fee0f75460377513bcc9c1d6951b094b1cad7 (patch)
treedf8941674d961d7e087d9ac79802c3b433088287 /sys/geom/vinum/geom_vinum_drive.c
parenteb12fefc3570c56802a22267d21da4b936c064b6 (diff)
downloadFreeBSD-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/geom_vinum_drive.c')
-rw-r--r--sys/geom/vinum/geom_vinum_drive.c14
1 files changed, 11 insertions, 3 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);
OpenPOWER on IntegriCloud