summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2014-08-01 01:32:10 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2014-08-01 01:32:10 +0000
commitee3284215ba0aac23bdba5f219c9ed62c3256f54 (patch)
tree75f6e665b7a3facd0916dda387d14e1e722fc536
parentc8396925088bfe02f62f14ecf80f86445193dc27 (diff)
When attempting to rebuild a softraid volume, use the actual data offset
from the volume metadata rather than the currently defined data offset. This allows rebuilds to work correctly when the volume metadata has a different data offset to that currently in use (for example, volumes created prior to softraid gaining boot support). Found the hard way by henning@ ok deraadt@
-rw-r--r--sys/dev/softraid.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index eea72614f22..f20c107c00d 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.337 2014/07/20 18:10:15 deraadt Exp $ */
+/* $OpenBSD: softraid.c,v 1.338 2014/08/01 01:32:09 jsing Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -3183,7 +3183,7 @@ sr_rebuild_init(struct sr_discipline *sd, dev_t dev, int hotspare)
/* Is the partition large enough? */
size = DL_SECTOBLK(&label, DL_GETPSIZE(&label.d_partitions[part])) -
- SR_DATA_OFFSET;
+ sd->sd_meta->ssd_data_offset;
if (size < csize) {
sr_error(sc, "%s partition too small, at least %lld bytes "
"required", devname, (long long)(csize << DEV_BSHIFT));