diff options
author | trasz <trasz@FreeBSD.org> | 2013-09-24 18:24:01 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2013-09-24 18:24:01 +0000 |
commit | 669071cdb3ab52c65996b09f3623ca355e8ac005 (patch) | |
tree | 653dee39b1a6cc755ee79693ccd7eac8316e00f8 /sys/dev/iscsi/iscsi.c | |
parent | d3e442de8589dadbe7ff361f4c6929d31ecb5272 (diff) | |
download | FreeBSD-src-669071cdb3ab52c65996b09f3623ca355e8ac005.zip FreeBSD-src-669071cdb3ab52c65996b09f3623ca355e8ac005.tar.gz |
As it turns out, when MOD_LOAD handler returns error, kernel calls MOD_UNLOAD
handler. Make the new iSCSI initiator not panic when this happens.
Approved by: re (glebius)
Sponsored by: FreeBSD Foundation
Diffstat (limited to 'sys/dev/iscsi/iscsi.c')
-rw-r--r-- | sys/dev/iscsi/iscsi.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index e22ded3..bc2fcc1 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -2036,10 +2036,6 @@ iscsi_load(void) NULL, UID_ROOT, GID_WHEEL, 0600, "iscsi"); if (error != 0) { ISCSI_WARN("failed to create device node, error %d", error); - sx_destroy(&sc->sc_lock); - cv_destroy(&sc->sc_cv); - uma_zdestroy(iscsi_outstanding_zone); - free(sc, M_ISCSI); return (error); } sc->sc_cdev->si_drv1 = sc; @@ -2056,16 +2052,16 @@ iscsi_load(void) static int iscsi_unload(void) { - /* - * XXX: kldunload hangs on "devdrn". - */ struct iscsi_session *is, *tmp; - ISCSI_DEBUG("removing device node"); - destroy_dev(sc->sc_cdev); - ISCSI_DEBUG("device node removed"); + if (sc->sc_cdev != NULL) { + ISCSI_DEBUG("removing device node"); + destroy_dev(sc->sc_cdev); + ISCSI_DEBUG("device node removed"); + } - EVENTHANDLER_DEREGISTER(shutdown_post_sync, sc->sc_shutdown_eh); + if (sc->sc_shutdown_eh != NULL) + EVENTHANDLER_DEREGISTER(shutdown_post_sync, sc->sc_shutdown_eh); sx_slock(&sc->sc_lock); TAILQ_FOREACH_SAFE(is, &sc->sc_sessions, is_next, tmp) |