summaryrefslogtreecommitdiffstats
path: root/sys/dev/softraid.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-08-01 01:32:09 +0000
committerjsing <jsing@openbsd.org>2014-08-01 01:32:09 +0000
commit76a3a0a1054968f8b027e1b67714e9c1d7583670 (patch)
tree6283aae21c1515bd51c8312df6da21158402ac7c /sys/dev/softraid.c
parentunbreak the build - e2fs_isave now needs the superblock. (diff)
downloadwireguard-openbsd-76a3a0a1054968f8b027e1b67714e9c1d7583670.tar.xz
wireguard-openbsd-76a3a0a1054968f8b027e1b67714e9c1d7583670.zip
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@
Diffstat (limited to 'sys/dev/softraid.c')
-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));