diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2009-06-23 15:54:45 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2009-06-23 15:54:45 +0000 |
commit | d3790808afec433ce50814303ce5b2b75e6e3cd0 (patch) | |
tree | 25f47168cf652d03f1887e34faea1a0da21e36af /sys/dev | |
parent | bf07e90847a12b4c2ddd7ce208b77b915c583e56 (diff) |
Make sure that the metadata level matches the requested assembly level when
creating a volume.
ok marco@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/softraid.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index fa1b0308df5..3333f461edb 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.157 2009/06/23 15:51:35 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.158 2009/06/23 15:54:44 jsing Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -2292,7 +2292,14 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, int user) /* metadata SHALL be fully filled in at this point */ - if (sr_discipline_init(sd, bc->bc_level)) { + /* Make sure that metadata level matches assembly level. */ + if (sd->sd_meta->ssdi.ssd_level != bc->bc_level) { + printf("%s: volume level does not match metadata level!\n", + DEVNAME(sc)); + goto unwind; + } + + if (sr_discipline_init(sd, sd->sd_meta->ssdi.ssd_level)) { printf("%s: could not initialize discipline\n", DEVNAME(sc)); goto unwind; } |