summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorle <le@FreeBSD.org>2004-02-08 15:27:58 +0000
committerle <le@FreeBSD.org>2004-02-08 15:27:58 +0000
commit2bc503d17463a087c4614a6f4aefd08f55af9d33 (patch)
tree49df3c6d17dfd01c213cca2c9e42322ba767ba85 /sys/dev
parentfc7590207e5330d1ec0fcdb5a0fd6a584493f6e2 (diff)
downloadFreeBSD-src-2bc503d17463a087c4614a6f4aefd08f55af9d33.zip
FreeBSD-src-2bc503d17463a087c4614a6f4aefd08f55af9d33.tar.gz
Don't free ressources that haven't been allocated. This should fix
the "disappearing subdisks" problem when new subdisks can't be created due to some errors. This is in fact an ugly hack, but a more elegant solution would probably require a redesign of vinum in several places. Approved by: joerg (mentor)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/vinum/vinumconfig.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/vinum/vinumconfig.c b/sys/dev/vinum/vinumconfig.c
index f556f77..e622eb1 100644
--- a/sys/dev/vinum/vinumconfig.c
+++ b/sys/dev/vinum/vinumconfig.c
@@ -1232,8 +1232,15 @@ config_subdisk(int update)
PLEX[sd->plexno].name,
sizeof(sd->name));
else { /* no way */
- if (sd->state == sd_unallocated) /* haven't finished allocating the sd, */
- free_sd(sdno); /* free it to return drive space */
+ if (sd->state == sd_unallocated) { /* haven't finished allocating the sd, */
+ if (autosize != 0) { /* but we might have allocated drive space */
+ vinum_conf.subdisks_used++; /* ugly hack needed for free_sd() */
+ free_sd(sdno); /* free it to return drive space */
+ } else { /* just clear it */
+ bzero(sd, sizeof(struct sd));
+ sd->state = sd_unallocated;
+ }
+ }
throw_rude_remark(EINVAL, "Unnamed sd is not associated with a plex");
}
sprintf(sdsuffix, ".s%d", sdindex); /* form the suffix */
OpenPOWER on IntegriCloud