changeset 14075:f73fc37ec88d

3866 panic in idm module 3867 stmfCreateLu failed: GUID_IN_USE 3868 iscsi target not accepting any new connections Reviewed by: Sebastien Roy <sebastien.roy@delphix.com> Reviewed by: Jeremy Jones <jeremy@delphix.com> Reviewed by: Eric Diven <eric.diven@delphix.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Reviewed by: T Nguyen <truongqnguien@gmail.com> Approved by: Gordon Ross <gwr@nexenta.com>
author Jeff Biseda <jeff.biseda@delphix.com>
date Mon, 08 Jul 2013 08:57:02 -0800
parents cac17ab5e600
children fa08ad0765cf
files usr/src/uts/common/io/comstar/stmf/stmf.c usr/src/uts/common/io/idm/idm_conn_sm.c usr/src/uts/common/io/idm/idm_so.c
diffstat 3 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/comstar/stmf/stmf.c	Sun Jul 07 18:18:37 2013 -0800
+++ b/usr/src/uts/common/io/comstar/stmf/stmf.c	Mon Jul 08 08:57:02 2013 -0800
@@ -5700,6 +5700,7 @@
 	struct ether_addr mac;
 	uint8_t *e = (uint8_t *)&mac;
 	int hid = (int)host_id;
+	uint16_t gen_number;
 
 	if (company_id == COMPANY_ID_NONE)
 		company_id = COMPANY_ID_SUN;
@@ -5709,7 +5710,7 @@
 
 	p = (uint8_t *)lu_id;
 
-	atomic_add_16(&stmf_lu_id_gen_number, 1);
+	gen_number = atomic_add_16_nv(&stmf_lu_id_gen_number, 1);
 
 	p[0] = 0xf1; p[1] = 3; p[2] = 0; p[3] = 0x10;
 	p[4] = ((company_id >> 20) & 0xf) | 0x60;
@@ -5730,8 +5731,8 @@
 	uniqtime32(&timestamp32);
 	*t = BE_32(*t);
 	bcopy(t, p+14, 4);
-	p[18] = (stmf_lu_id_gen_number >> 8) & 0xff;
-	p[19] = stmf_lu_id_gen_number & 0xff;
+	p[18] = (gen_number >> 8) & 0xff;
+	p[19] = gen_number & 0xff;
 
 	return (STMF_SUCCESS);
 }
--- a/usr/src/uts/common/io/idm/idm_conn_sm.c	Sun Jul 07 18:18:37 2013 -0800
+++ b/usr/src/uts/common/io/idm/idm_conn_sm.c	Mon Jul 08 08:57:02 2013 -0800
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
  */
 
 #include <sys/cpuvar.h>
@@ -609,6 +610,7 @@
 		 * connections are shut down by a CE_LOGOUT_SESSION_SUCCESS
 		 * event sent from the session to the IDM layer.
 		 */
+		(void) untimeout(ic->ic_state_timeout);
 		if (IDM_CONN_ISTGT(ic)) {
 			ic->ic_transport_ops->it_tgt_conn_disconnect(ic);
 		} else {
--- a/usr/src/uts/common/io/idm/idm_so.c	Sun Jul 07 18:18:37 2013 -0800
+++ b/usr/src/uts/common/io/idm/idm_so.c	Mon Jul 08 08:57:02 2013 -0800
@@ -1249,10 +1249,15 @@
 		    (struct sockaddr *)&t_addr, &t_addrlen,
 		    &new_so, CRED())) != 0) {
 			mutex_enter(&svc->is_mutex);
-			if (rc == ECONNABORTED)
-				continue;
-			/* Connection problem */
-			break;
+			if (rc != ECONNABORTED && rc != EINTR) {
+				IDM_SVC_LOG(CE_NOTE, "idm_so_svc_port_watcher:"
+				    " ksocket_accept failed %d", rc);
+			}
+			/*
+			 * Unclean shutdown of this thread is not handled
+			 * wait for !is_thread_running.
+			 */
+			continue;
 		}
 		/*
 		 * Turn off SO_MAC_EXEMPT so future sobinds succeed