From: jsing Date: Fri, 1 Aug 2014 01:32:09 +0000 (+0000) Subject: When attempting to rebuild a softraid volume, use the actual data offset X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=76a3a0a1054968f8b027e1b67714e9c1d7583670;p=openbsd 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@ --- 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 * Copyright (c) 2008 Chris Kuethe @@ -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));