-/* $OpenBSD: softraid.c,v 1.331 2014/01/22 23:32:42 jsing Exp $ */
+/* $OpenBSD: softraid.c,v 1.332 2014/07/10 12:21:09 mpi Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
void sr_set_vol_state(struct sr_discipline *);
/* utility functions */
-void sr_shutdown(struct sr_softc *);
-void sr_shutdownhook(void *);
+void sr_shutdown(void);
void sr_uuid_generate(struct sr_uuid *);
char *sr_uuid_format(struct sr_uuid *);
void sr_uuid_print(struct sr_uuid *, int);
softraid_disk_attach = sr_disk_attach;
- sc->sc_shutdownhook = shutdownhook_establish(sr_shutdownhook, sc);
-
sr_boot_assembly(sc);
explicit_bzero(sr_bootkey, sizeof(sr_bootkey));
DNPRINTF(SR_D_MISC, "%s: sr_detach\n", DEVNAME(sc));
- if (sc->sc_shutdownhook)
- shutdownhook_disestablish(sc->sc_shutdownhook);
-
softraid_disk_attach = NULL;
- sr_shutdown(sc);
+ sr_shutdown();
#ifndef SMALL_KERNEL
if (sc->sc_sensor_task != NULL)
}
void
-sr_shutdownhook(void *arg)
-{
- sr_shutdown((struct sr_softc *)arg);
-}
-
-void
-sr_shutdown(struct sr_softc *sc)
+sr_shutdown(void)
{
+ struct sr_softc *sc = softraid0;
struct sr_discipline *sd;
DNPRINTF(SR_D_MISC, "%s: sr_shutdown\n", DEVNAME(sc));
+ /*
+ * Since softraid is not under mainbus, we have to explicitly
+ * notify its children that the power is going down, so they
+ * can execute their shutdown hooks.
+ */
+ config_suspend((struct device *)sc, DVACT_POWERDOWN);
+
/* Shutdown disciplines in reverse attach order. */
while ((sd = TAILQ_LAST(&sc->sc_dis_list, sr_discipline_list)) != NULL)
sr_discipline_shutdown(sd, 1);
-/* $OpenBSD: softraidvar.h,v 1.154 2014/01/22 09:42:13 jsing Exp $ */
+/* $OpenBSD: softraidvar.h,v 1.155 2014/07/10 12:21:09 mpi Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
struct sr_softc {
struct device sc_dev;
- void (*sc_shutdownhook)(void *);
-
struct rwlock sc_lock;
struct bio_status sc_status; /* Status and messages. */
-/* $OpenBSD: vfs_subr.c,v 1.215 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.216 2014/07/10 12:21:08 mpi Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
#include <netinet/in.h>
+#include "softraid.h"
+
+void sr_shutdown(void);
+
enum vtype iftovt_tab[16] = {
VNON, VFIFO, VCHR, VNON, VDIR, VNON, VBLK, VNON,
VREG, VNON, VLNK, VNON, VSOCK, VNON, VNON, VBAD,
printf("giving up\n");
else
printf("done\n");
+
+#if NSOFTRAID > 0
+ sr_shutdown();
+#endif
}
/*