diff options
author | 2006-09-25 22:49:28 +0000 | |
---|---|---|
committer | 2006-09-25 22:49:28 +0000 | |
commit | 71c49f75961f3dc8d2ef4b774a96f89c4a07e470 (patch) | |
tree | b84c2168d26def48ff0cc8d962089f58037e1327 | |
parent | enabling interrupts isnt a bug, so dont put XXX next to it. (diff) | |
download | wireguard-openbsd-71c49f75961f3dc8d2ef4b774a96f89c4a07e470.tar.xz wireguard-openbsd-71c49f75961f3dc8d2ef4b774a96f89c4a07e470.zip |
well, this is embarrassing.
it turns out a drivers detach code isnt called when the machine is shutting
down, which meant my bits to stop bgrb and sync the cache werent being
run. without those bits being run the filesystems on these controllers
were never clean on reboot, so we'd always get an fsck.
so now we provide a shutdown hook which does get run on shutdown to sync
the cache properly.
found by claudio@
-rw-r--r-- | sys/dev/pci/arc.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c index f90d1b0a686..a30ba78c2d0 100644 --- a/sys/dev/pci/arc.c +++ b/sys/dev/pci/arc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc.c,v 1.49 2006/09/25 22:44:56 dlg Exp $ */ +/* $OpenBSD: arc.c,v 1.50 2006/09/25 22:49:28 dlg Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -350,6 +350,7 @@ struct arc_fw_sysinfo { int arc_match(struct device *, void *, void *); void arc_attach(struct device *, struct device *, void *); int arc_detach(struct device *, int); +void arc_shutdown(void *); int arc_intr(void *); struct arc_ccb; @@ -369,6 +370,8 @@ struct arc_softc { void *sc_ih; + void *sc_shutdownhook; + int sc_req_count; struct arc_dmamem *sc_requests; @@ -517,6 +520,10 @@ arc_attach(struct device *parent, struct device *self, void *aux) return; } + sc->sc_shutdownhook = shutdownhook_establish(arc_shutdown, sc); + if (sc->sc_shutdownhook == NULL) + panic("unable to establish arc powerhook"); + sc->sc_link.device = &arc_dev; sc->sc_link.adapter = &arc_switch; sc->sc_link.adapter_softc = sc; @@ -544,6 +551,8 @@ arc_detach(struct device *self, int flags) { struct arc_softc *sc = (struct arc_softc *)self; + shutdownhook_disestablish(sc->sc_shutdownhook); + if (arc_msg0(sc, ARC_REG_INB_MSG0_STOP_BGRB) != 0) printf("%s: timeout waiting to stop bg rebuild\n"); @@ -553,6 +562,18 @@ arc_detach(struct device *self, int flags) return (0); } +void +arc_shutdown(void *xsc) +{ + struct arc_softc *sc = xsc; + + if (arc_msg0(sc, ARC_REG_INB_MSG0_STOP_BGRB) != 0) + printf("%s: timeout waiting to stop bg rebuild\n"); + + if (arc_msg0(sc, ARC_REG_INB_MSG0_FLUSH_CACHE) != 0) + printf("%s: timeout waiting to flush cache\n"); +} + int arc_intr(void *arg) { |