Mercurial > illumos > illumos-gate
changeset 11730:1d9187deede6
6908887 shutdown of cluster node hangs long time with iscsi discovery failure
6885238 confusing notice during the reboot of iSCSI rooted Solaris
6911748 Unable to unload iscsi module
author | Jack Meng <Jack.Meng@Sun.COM> |
---|---|
date | Mon, 22 Feb 2010 09:39:28 +0800 |
parents | 8922e660c576 |
children | 2050b360ab01 |
files | usr/src/cmd/iscsid/iscsid.c usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c |
diffstat | 3 files changed, 27 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/iscsid/iscsid.c Sat Feb 20 13:04:40 2010 +0800 +++ b/usr/src/cmd/iscsid/iscsid.c Mon Feb 22 09:39:28 2010 +0800 @@ -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 @@ 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 @@ 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 @@ (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:
--- a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c Sat Feb 20 13:04:40 2010 +0800 +++ b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c Mon Feb 22 09:39:28 2010 +0800 @@ -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 @@ } 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 @@ } rval = iscsid_stop(ihp); - - 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_door_unbind(); + + 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:
--- a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c Sat Feb 20 13:04:40 2010 +0800 +++ b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c Mon Feb 22 09:39:28 2010 +0800 @@ -336,19 +336,15 @@ /* * 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 @@ } 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 @@ } 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); }