diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/iscsid/iscsid.c | 15 | ||||
-rw-r--r-- | usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c | 20 | ||||
-rw-r--r-- | usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c | 18 |
3 files changed, 26 insertions, 27 deletions
diff --git a/usr/src/cmd/iscsid/iscsid.c b/usr/src/cmd/iscsid/iscsid.c index 268dcfe3c0..6d134689e4 100644 --- a/usr/src/cmd/iscsid/iscsid.c +++ b/usr/src/cmd/iscsid/iscsid.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -132,6 +132,7 @@ main( int retry = 0; sigset_t sigs, allsigs; struct sigaction act; + uint32_t rval; /* * Get the locale set up before calling any other routines @@ -262,10 +263,8 @@ main( case SIGTERM: do { ret = ioctl(iscsi_dev_handle, - ISCSI_SMF_OFFLINE, NULL); + ISCSI_SMF_OFFLINE, &rval); if (ret == -1) { - perror(gettext("ioctl: disable" - " iscsi initiator")); /* * Keep retrying if unable * to stop @@ -273,9 +272,13 @@ main( (void) sleep(ISCSI_SMF_OFFLINE_DELAY); retry++; } - } while (ret == -1 && - retry < ISCSI_SMF_OFFLINE_MAX_RETRY_TIMES); + } while ((ret == -1) && + (retry < ISCSI_SMF_OFFLINE_MAX_RETRY_TIMES)); (void) close(iscsi_dev_handle); + if (rval == B_FALSE) { + syslog(LOG_DAEMON, gettext("iSCSI initiator" + " service exited with sessions left.")); + } return (0); break; default: diff --git a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c index cbe12e6c75..16c7a930de 100644 --- a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c +++ b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c @@ -20,7 +20,7 @@ */ /* * Copyright 2000 by Cisco Systems, Inc. All rights reserved. - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * iSCSI Software Initiator @@ -1277,7 +1277,12 @@ iscsi_tran_bus_unconfig(dev_info_t *parent, uint_t flag, } if (iscsi_client_request_service(ihp) == B_FALSE) { - return (NDI_FAILURE); + rw_enter(&ihp->hba_sess_list_rwlock, RW_READER); + if (ihp->hba_sess_list != NULL) { + rval = NDI_FAILURE; + } + rw_exit(&ihp->hba_sess_list_rwlock); + return (rval); } rval = ndi_busop_bus_unconfig(parent, flag, op, arg); @@ -4049,14 +4054,15 @@ iscsi_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, } rval = iscsid_stop(ihp); + iscsi_door_unbind(); - if (rval == B_TRUE) { - iscsi_exit_service_zone(ihp, ISCSI_SERVICE_DISABLED); - iscsi_door_unbind(); - } else { - iscsi_exit_service_zone(ihp, ISCSI_SERVICE_ENABLED); + iscsi_exit_service_zone(ihp, ISCSI_SERVICE_DISABLED); + + if (ddi_copyout((void *)&rval, (caddr_t)arg, + sizeof (boolean_t), mode) != 0) { rtn = EFAULT; } + break; case ISCSI_SMF_GET: diff --git a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c index d700bc35a9..1e1125b5bd 100644 --- a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c +++ b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c @@ -336,19 +336,15 @@ iscsid_start(iscsi_hba_t *ihp) { /* * iscsid_stop -- stop the iscsi initiator daemon, by disabling * all the discovery methods first, and then try to stop all - * related threads + * related threads. This is a try-best effort, leave any 'busy' device + * (and therefore session) there and just return. */ boolean_t iscsid_stop(iscsi_hba_t *ihp) { boolean_t rval = B_FALSE; iscsi_sess_t *isp = NULL; - if (iscsid_disable_discovery(ihp, - ISCSI_ALL_DISCOVERY_METHODS) == B_FALSE) { - (void) iscsid_enable_discovery(ihp, - ISCSI_ALL_DISCOVERY_METHODS, B_TRUE); - return (rval); - } + (void) iscsid_disable_discovery(ihp, ISCSI_ALL_DISCOVERY_METHODS); /* final check */ rw_enter(&ihp->hba_sess_list_rwlock, RW_READER); @@ -357,7 +353,7 @@ iscsid_stop(iscsi_hba_t *ihp) { } else { /* * If only boot session is left, that is OK. - * Otherwise, we should consider stop failed. + * Otherwise, we should report that some sessions are left. */ rval = B_TRUE; for (isp = ihp->hba_sess_list; isp != NULL; @@ -370,12 +366,6 @@ iscsid_stop(iscsi_hba_t *ihp) { } rw_exit(&ihp->hba_sess_list_rwlock); - if (rval == B_FALSE) { - (void) iscsid_enable_discovery(ihp, - ISCSI_ALL_DISCOVERY_METHODS, B_TRUE); - return (rval); - } - return (rval); } |