aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Ertl <le@FreeBSD.org>2005-08-15 17:07:47 +0000
committerLukas Ertl <le@FreeBSD.org>2005-08-15 17:07:47 +0000
commit8cc5eb98ad2a6fc8105187e15a8eeca7b40abd4b (patch)
tree812ca879932f3713168f4e345bbff859600114b6
parentf7098e14b46dc5fa89caf96c8366a5b8facb2325 (diff)
downloadsrc-8cc5eb98ad2a6fc8105187e15a8eeca7b40abd4b.tar.gz
src-8cc5eb98ad2a6fc8105187e15a8eeca7b40abd4b.zip
Fix a stupid logic bug introduced in geom_vinum_drive.c rev 1.18:
When a drive is newly created, it's state is initially set to 'down', so it won't allow saving the config to it (thus it will never know of itself being created). Work around this by adding a new flag, that's also checked when saving the config to a drive.
Notes
Notes: svn path=/head/; revision=149094
-rw-r--r--sys/geom/vinum/geom_vinum.c2
-rw-r--r--sys/geom/vinum/geom_vinum_drive.c7
-rw-r--r--sys/geom/vinum/geom_vinum_var.h1
3 files changed, 9 insertions, 1 deletions
diff --git a/sys/geom/vinum/geom_vinum.c b/sys/geom/vinum/geom_vinum.c
index 01ccbcb2fa0b..7cddd3a09722 100644
--- a/sys/geom/vinum/geom_vinum.c
+++ b/sys/geom/vinum/geom_vinum.c
@@ -312,6 +312,7 @@ gv_create(struct g_geom *gp, struct gctl_req *req)
gv_config_new_drive(d);
+ d->flags |= GV_DRIVE_NEWBORN;
LIST_INSERT_HEAD(&sc->drives, d, drive);
}
@@ -461,6 +462,7 @@ gv_create(struct g_geom *gp, struct gctl_req *req)
g_destroy_consumer(cp);
} else
gv_save_config(NULL, d, sc);
+ d->flags &= ~GV_DRIVE_NEWBORN;
}
return (0);
diff --git a/sys/geom/vinum/geom_vinum_drive.c b/sys/geom/vinum/geom_vinum_drive.c
index 8027ed216e90..3bf237f8795b 100644
--- a/sys/geom/vinum/geom_vinum_drive.c
+++ b/sys/geom/vinum/geom_vinum_drive.c
@@ -113,7 +113,12 @@ gv_save_config(struct g_consumer *cp, struct gv_drive *d, struct gv_softc *sc)
KASSERT(d != NULL, ("gv_save_config: null d"));
KASSERT(sc != NULL, ("gv_save_config: null sc"));
- if (d->state != GV_DRIVE_UP)
+ /*
+ * We can't save the config on a drive that isn't up, but drives that
+ * were just created aren't officially up yet, so we check a special
+ * flag.
+ */
+ if ((d->state != GV_DRIVE_UP) && !(d->flags && GV_DRIVE_NEWBORN))
return;
if (cp == NULL) {
diff --git a/sys/geom/vinum/geom_vinum_var.h b/sys/geom/vinum/geom_vinum_var.h
index 47da3726f755..3de2b44a3901 100644
--- a/sys/geom/vinum/geom_vinum_var.h
+++ b/sys/geom/vinum/geom_vinum_var.h
@@ -189,6 +189,7 @@ struct gv_drive {
#define GV_DRIVE_THREAD_ACTIVE 0x01 /* Drive has an active worker thread. */
#define GV_DRIVE_THREAD_DIE 0x02 /* Signal the worker thread to die. */
#define GV_DRIVE_THREAD_DEAD 0x04 /* The worker thread has died. */
+#define GV_DRIVE_NEWBORN 0x08 /* The drive was just created. */
struct gv_hdr *hdr; /* The drive header. */