diff options
author | le <le@FreeBSD.org> | 2006-02-08 21:32:45 +0000 |
---|---|---|
committer | le <le@FreeBSD.org> | 2006-02-08 21:32:45 +0000 |
commit | 40531c331d4f6e2525d4963e86be8b2a04dbe81e (patch) | |
tree | b04d9cfccd111c1edd4969458c7b352c868a97db /sys | |
parent | fa47370bfce1f074ab01e335dc480baf5d8dc7c1 (diff) | |
download | FreeBSD-src-40531c331d4f6e2525d4963e86be8b2a04dbe81e.zip FreeBSD-src-40531c331d4f6e2525d4963e86be8b2a04dbe81e.tar.gz |
Catch the case when a subdisk has no provider or no consumer
attached to it.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/geom/vinum/geom_vinum_move.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/geom/vinum/geom_vinum_move.c b/sys/geom/vinum/geom_vinum_move.c index 6b63c35..9a22684 100644 --- a/sys/geom/vinum/geom_vinum_move.c +++ b/sys/geom/vinum/geom_vinum_move.c @@ -113,7 +113,7 @@ gv_move_sd(struct gv_softc *sc, struct gctl_req *req, struct gv_sd *cursd, char cp = cursd->consumer; - if (cp->acr || cp->acw || cp->ace) { + if (cp != NULL && (cp->acr || cp->acw || cp->ace)) { gctl_error(req, "subdisk '%s' is busy", cursd->name); return (-1); } @@ -178,7 +178,8 @@ gv_move_sd(struct gv_softc *sc, struct gctl_req *req, struct gv_sd *cursd, char } /* Replace the old sd by the new one. */ - g_detach(cp); + if (cp != NULL) + g_detach(cp); LIST_FOREACH_SAFE(s, &p->subdisks, in_plex, s2) { if (s == cursd) { p->sdcount--; @@ -196,13 +197,15 @@ gv_move_sd(struct gv_softc *sc, struct gctl_req *req, struct gv_sd *cursd, char gv_drive_modify(d); /* And reconnect the consumer ... */ - newsd->consumer = cp; - err = g_attach(cp, newsd->provider); - if (err) { - g_destroy_consumer(cp); - gctl_error(req, "proposed move would create a loop in GEOM " - "config"); - return (err); + if (cp != NULL) { + newsd->consumer = cp; + err = g_attach(cp, newsd->provider); + if (err) { + g_destroy_consumer(cp); + gctl_error(req, "proposed move would create a loop " + "in GEOM config"); + return (err); + } } LIST_INSERT_HEAD(&sc->subdisks, newsd, sd); |