summaryrefslogtreecommitdiffstats
path: root/sys/dev/iscsi/iscsi.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2013-09-24 18:24:01 +0000
committertrasz <trasz@FreeBSD.org>2013-09-24 18:24:01 +0000
commit669071cdb3ab52c65996b09f3623ca355e8ac005 (patch)
tree653dee39b1a6cc755ee79693ccd7eac8316e00f8 /sys/dev/iscsi/iscsi.c
parentd3e442de8589dadbe7ff361f4c6929d31ecb5272 (diff)
downloadFreeBSD-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.c18
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)
OpenPOWER on IntegriCloud