-/* $OpenBSD: softraid.c,v 1.427 2022/09/11 19:34:40 miod Exp $ */
+/* $OpenBSD: softraid.c,v 1.428 2022/12/18 13:10:08 kn Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
}
}
+ /*
+ * XXX Better check for mounted file systems and refuse to detach any
+ * volume that is actively in use.
+ */
+ if (bcmp(&sr_bootuuid, &sd->sd_meta->ssdi.ssd_uuid,
+ sizeof(sr_bootuuid)) == 0) {
+ sr_error(sc, "refusing to delete boot volume");
+ goto bad;
+ }
+
sd->sd_deleted = 1;
sd->sd_meta->ssdi.ssd_vol_flags = BIOC_SCNOAUTOASSEMBLE;
sr_discipline_shutdown(sd, 1, 0);