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/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;