From c4dfe4abe23dd2481f0ab9125bef4e06bde37a8f Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Sun, 1 Dec 2013 08:13:10 +0000 Subject: [PATCH] Fix hang on reboot with active iSCSI connections. MFC after: 3 days Sponsored by: The FreeBSD Foundation --- sys/dev/iscsi/iscsi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 1e65416b2aa..2f5328db322 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -2110,10 +2110,12 @@ iscsi_load(void) sc->sc_cdev->si_drv1 = sc; /* - * XXX: For some reason this doesn't do its job; active sessions still hang out there - * after final sync, making the reboot effectively hang. + * Note that this needs to get run before dashutdown(). Otherwise, + * when rebooting with iSCSI session with outstanding requests, + * but disconnected, dashutdown() will hang on cam_periph_runccb(). */ - sc->sc_shutdown_eh = EVENTHANDLER_REGISTER(shutdown_post_sync, iscsi_shutdown, sc, SHUTDOWN_PRI_DEFAULT); + sc->sc_shutdown_eh = EVENTHANDLER_REGISTER(shutdown_post_sync, + iscsi_shutdown, sc, SHUTDOWN_PRI_FIRST); return (0); }