summaryrefslogtreecommitdiffstats
path: root/sys/geom/vinum/geom_vinum.c
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2004-06-24 02:40:34 +0000
committercsjp <csjp@FreeBSD.org>2004-06-24 02:40:34 +0000
commit7e172b8cb66238e8e80711237db946fabf250107 (patch)
tree967d7d8b4496aeba8f080163f8cbe0136acd7d32 /sys/geom/vinum/geom_vinum.c
parent73ce2e712d916eba1decb5650d2acf5768d602b4 (diff)
downloadFreeBSD-src-7e172b8cb66238e8e80711237db946fabf250107.zip
FreeBSD-src-7e172b8cb66238e8e80711237db946fabf250107.tar.gz
Currently, if the drives specified for volume creation are
not active GEOM providers, it will result in a kernel panic. If the GEOM provider or disk goes away before the volume configuration data gets written to the disk, it will result in another kernel panic. o Make sure that the drives specified for volume creation are active GEOM providers. o When writing out volume configuration data to associated drives, make sure that the GEOM provider is active, otherwise continue to the next drive in the volume. Approved by: le, bmilekic (mentor)
Diffstat (limited to 'sys/geom/vinum/geom_vinum.c')
-rw-r--r--sys/geom/vinum/geom_vinum.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/geom/vinum/geom_vinum.c b/sys/geom/vinum/geom_vinum.c
index 6ede025..d4cdbaa 100644
--- a/sys/geom/vinum/geom_vinum.c
+++ b/sys/geom/vinum/geom_vinum.c
@@ -319,8 +319,16 @@ gv_create(struct g_geom *gp, struct gctl_req *req)
d = g_malloc(sizeof(*d), M_WAITOK | M_ZERO);
bcopy(d2, d, sizeof(*d));
- /* XXX */
+ /*
+ * Make sure that the provider specified in the drive
+ * specification is an active GEOM provider.
+ */
pp = g_provider_by_name(d->device);
+ if (pp == NULL) {
+ gctl_error(req, "%s: drive not found", d->device);
+ g_free(d);
+ return (-1);
+ }
d->size = pp->mediasize - GV_DATA_START;
d->avail = d->size;
@@ -456,8 +464,17 @@ gv_create(struct g_geom *gp, struct gctl_req *req)
*/
LIST_FOREACH(d, &sc->drives, drive) {
if (d->geom == NULL) {
- /* XXX */
+ /*
+ * XXX if the provider disapears before we get a chance
+ * to write the config out to the drive, should this
+ * be handled any differently?
+ */
pp = g_provider_by_name(d->device);
+ if (pp == NULL) {
+ printf("geom_vinum: %s: drive disapeared?\n",
+ d->device);
+ continue;
+ }
cp = g_new_consumer(gp);
g_attach(cp, pp);
gv_save_config(cp, d, sc);
OpenPOWER on IntegriCloud