Hi,
I'm testing some SoftRAID in a Mirroring setup and stumbled upon
something. When I set a disk offline, zero out the disk and the
metadata blocks, reboot, and then try to assemble it, it will
fail. Rightfully so, since the metadata information is completely
gone from one disk. That's not a reassemble, that's a rebuild.
Now in the case that I want to actually force a whole new RAID
it looks like I have to pass -C force, to clear the metadata and
force creation of a new RAID. Unfortunately this does not work,
because sr_meta_native_attach(), which is called by
sr_meta_native_attach(), wants to make sure that all devices are
either non-SoftRAID or SoftRAID. Now in my case the disks are
kinda both. One zeroed, one not. In that case sr && not_sr is
true and it will exit with "not all chunks are of the native
metadata format".
Is there a reason that sr_meta_attach() has to be called before
clearing the metadata on force?
Untested diff below.
Patrick
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 8b75f238072..24d64fb8226 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -3368,9 +3368,6 @@ sr_ioctl_createraid(struct sr_softc *sc, struct
bioc_createraid *bc,
goto unwind;
}
- if (sr_meta_attach(sd, no_chunk, bc->bc_flags & BIOC_SCFORCE))
- goto unwind;
-
/* force the raid volume by clearing metadata region */
if (bc->bc_flags & BIOC_SCFORCE) {
/* make sure disk isn't up and running */
@@ -3390,6 +3387,9 @@ sr_ioctl_createraid(struct sr_softc *sc, struct
bioc_createraid *bc,
}
}
+ if (sr_meta_attach(sd, no_chunk, bc->bc_flags & BIOC_SCFORCE))
+ goto unwind;
+
no_meta = sr_meta_read(sd);
if (no_meta == -1) {