summaryrefslogtreecommitdiffstats
path: root/sys/geom/mirror/g_mirror_ctl.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-04-10 10:32:22 +0000
committerpjd <pjd@FreeBSD.org>2006-04-10 10:32:22 +0000
commitd7eb5b2fe93038a4783beb3079adb93fae2c27b0 (patch)
tree4dd1886c4f76f51d427f0bee1667c6f7f03e59c6 /sys/geom/mirror/g_mirror_ctl.c
parenteb2ebcc8553acb18cc95142aacf36557bd7b4a97 (diff)
downloadFreeBSD-src-d7eb5b2fe93038a4783beb3079adb93fae2c27b0.zip
FreeBSD-src-d7eb5b2fe93038a4783beb3079adb93fae2c27b0.tar.gz
Introduce and use delayed-destruction functionality from a pre-sync hook,
which means that devices will be destroyed on last close. This fixes destruction order problems when, eg. RAID3 array is build on top of RAID1 arrays. Requested, reviewed and tested by: ru MFC after: 2 weeks
Diffstat (limited to 'sys/geom/mirror/g_mirror_ctl.c')
-rw-r--r--sys/geom/mirror/g_mirror_ctl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/geom/mirror/g_mirror_ctl.c b/sys/geom/mirror/g_mirror_ctl.c
index 4551ba7..a986913 100644
--- a/sys/geom/mirror/g_mirror_ctl.c
+++ b/sys/geom/mirror/g_mirror_ctl.c
@@ -628,6 +628,7 @@ g_mirror_ctl_stop(struct gctl_req *req, struct g_class *mp)
const char *name;
char param[16];
u_int i;
+ int how;
nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs));
if (nargs == NULL) {
@@ -643,6 +644,10 @@ g_mirror_ctl_stop(struct gctl_req *req, struct g_class *mp)
gctl_error(req, "No '%s' argument.", "force");
return;
}
+ if (*force)
+ how = G_MIRROR_DESTROY_HARD;
+ else
+ how = G_MIRROR_DESTROY_SOFT;
for (i = 0; i < (u_int)*nargs; i++) {
snprintf(param, sizeof(param), "arg%u", i);
@@ -656,7 +661,8 @@ g_mirror_ctl_stop(struct gctl_req *req, struct g_class *mp)
gctl_error(req, "No such device: %s.", name);
return;
}
- error = g_mirror_destroy(sc, *force);
+ g_cancel_event(sc);
+ error = g_mirror_destroy(sc, how);
if (error != 0) {
gctl_error(req, "Cannot destroy device %s (error=%d).",
sc->sc_geom->name, error);
OpenPOWER on IntegriCloud