diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -44,11 +44,13 @@ #include #include #include +#include #include #include #include #include #include + #include #include @@ -2711,10 +2713,10 @@ } static void -iscsi_shutdown_post(struct iscsi_softc *sc) +iscsi_shutdown_post_sync(struct iscsi_softc *sc, int howto) { - if (!KERNEL_PANICKED()) { + if ((howto & RB_NOSYNC) == 0) { ISCSI_DEBUG("removing all sessions due to shutdown"); iscsi_terminate_sessions(sc); } @@ -2751,7 +2753,7 @@ * cam_periph_runccb(). */ sc->sc_shutdown_post_eh = EVENTHANDLER_REGISTER(shutdown_post_sync, - iscsi_shutdown_post, sc, SHUTDOWN_PRI_DEFAULT - 1); + iscsi_shutdown_post_sync, sc, SHUTDOWN_PRI_DEFAULT - 1); return (0); } diff --git a/sys/dev/pst/pst-iop.c b/sys/dev/pst/pst-iop.c --- a/sys/dev/pst/pst-iop.c +++ b/sys/dev/pst/pst-iop.c @@ -432,7 +432,7 @@ int status, timeout = 10000; mtx_lock(&sc->mtx); - if (!(sc->reg->oqueue_intr_mask & 0x08)) { + if ((sc->reg->oqueue_intr_mask & I20_OUT_INTR_QUEUE) == 0) { msg->transaction_context = (u_int32_t)&request; msg->initiator_context = (u_int32_t)iop_done; sc->reg->iqueue = mfa; diff --git a/sys/dev/pst/pst-raid.c b/sys/dev/pst/pst-raid.c --- a/sys/dev/pst/pst-raid.c +++ b/sys/dev/pst/pst-raid.c @@ -73,7 +73,7 @@ static disk_strategy_t pststrategy; static int pst_probe(device_t); static int pst_attach(device_t); -static int pst_shutdown(device_t); +static void pst_shutdown_post_sync(device_t, int); static void pst_start(struct pst_softc *); static void pst_done(struct iop_softc *, u_int32_t, struct i2o_single_reply *); static int pst_rw(struct pst_request *); @@ -170,18 +170,23 @@ name, psc->info->capacity/(512*255*63), 255, 63, device_get_nameunit(psc->iop->dev)); - EVENTHANDLER_REGISTER(shutdown_post_sync, pst_shutdown, + EVENTHANDLER_REGISTER(shutdown_post_sync, pst_shutdown_post_sync, dev, SHUTDOWN_PRI_FIRST); return 0; } -static int -pst_shutdown(device_t dev) +static void +pst_shutdown_post_sync(device_t dev, int howto __unused) { struct pst_softc *psc = device_get_softc(dev); struct i2o_bsa_cache_flush_message *msg; int mfa; + if (SCHEDULER_STOPPED()) { + /* Request polled shutdown. */ + psc->reg->oqueue_intr_mask = 0xffffffff; + } + mfa = iop_get_mfa(psc->iop); msg = (struct i2o_bsa_cache_flush_message *)(psc->iop->ibase + mfa); bzero(msg, sizeof(struct i2o_bsa_cache_flush_message)); @@ -194,7 +199,6 @@ msg->control_flags = 0x0; /* 0x80 = post progress reports */ if (iop_queue_wait_msg(psc->iop, mfa, (struct i2o_basic_message *)msg)) printf("pst: shutdown failed!\n"); - return 0; } static void diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -2655,13 +2656,14 @@ static eventhandler_tag g_journal_event_lowmem = NULL; static void -g_journal_shutdown(void *arg, int howto __unused) +g_journal_shutdown_post_sync(void *arg, int howto) { struct g_class *mp; struct g_geom *gp, *gp2; - if (KERNEL_PANICKED()) + if ((howto & RB_NOSYNC) != 0) return; + mp = arg; g_topology_lock(); LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) { @@ -2738,7 +2740,7 @@ (g_journal_cache_limit / 100) * g_journal_cache_switch; } g_journal_event_shutdown = EVENTHANDLER_REGISTER(shutdown_post_sync, - g_journal_shutdown, mp, EVENTHANDLER_PRI_FIRST); + g_journal_shutdown_post_sync, mp, EVENTHANDLER_PRI_FIRST); if (g_journal_event_shutdown == NULL) GJ_DEBUG(0, "Warning! Cannot register shutdown event."); g_journal_event_lowmem = EVENTHANDLER_REGISTER(vm_lowmem, diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -3546,7 +3547,7 @@ struct g_mirror_softc *sc; int error; - if (KERNEL_PANICKED()) + if ((howto & RB_NOSYNC) != 0) return; mp = arg; diff --git a/sys/geom/raid/g_raid.c b/sys/geom/raid/g_raid.c --- a/sys/geom/raid/g_raid.c +++ b/sys/geom/raid/g_raid.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -2457,6 +2458,9 @@ struct g_raid_softc *sc; struct g_raid_volume *vol; + if ((howto & RB_NOSYNC) != 0) + return; + mp = arg; g_topology_lock(); g_raid_shutdown = 1; diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -3573,6 +3574,9 @@ struct g_raid3_softc *sc; int error; + if ((howto & RB_NOSYNC) != 0) + return; + mp = arg; g_topology_lock(); g_raid3_shutdown = 1;