changeset 6703:b961f9b565e9

6692187 iscsi target hit assert at 0, file ../t10_sam.c, line 578, i/o failed, dumped core 6705606 iscsi target needed timestamp in the logging to correlate events. 6705620 iscsi target throttling is too restrictive
author ts143224
date Fri, 23 May 2008 12:19:20 -0700
parents c62be08ca808
children 69d909654d1c
files usr/src/cmd/iscsi/iscsitgtd/iscsi_cmd.c usr/src/cmd/iscsi/iscsitgtd/util_queue.c
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/iscsi/iscsitgtd/iscsi_cmd.c	Fri May 23 11:34:29 2008 -0700
+++ b/usr/src/cmd/iscsi/iscsitgtd/iscsi_cmd.c	Fri May 23 12:19:20 2008 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -160,6 +160,7 @@
 iscsi_cmd_cancel(iscsi_conn_t *c, iscsi_cmd_t *cmd)
 {
 	(void) pthread_mutex_lock(&c->c_mutex);
+	(void) pthread_mutex_lock(&c->c_state_mutex);
 	if (cmd->c_state == CmdAlloc) {
 		cmd->c_state = CmdCanceled;
 		if (cmd->c_t10_cmd != NULL) {
@@ -167,6 +168,7 @@
 			cmd->c_t10_cmd = NULL;
 		}
 	}
+	(void) pthread_mutex_unlock(&c->c_state_mutex);
 	(void) pthread_mutex_unlock(&c->c_mutex);
 }
 
@@ -184,9 +186,8 @@
 void
 iscsi_cmd_remove(iscsi_conn_t *c, uint32_t statsn)
 {
-	iscsi_cmd_t	*cmd,
-			*cmd_free = NULL,
-			*n;
+	iscsi_cmd_t	*cmd, *n;
+	iscsi_cmd_t	*cmd_free = NULL;
 
 	(void) pthread_mutex_lock(&c->c_mutex);
 	for (cmd = c->c_cmd_head; cmd; ) {
@@ -290,7 +291,8 @@
 		 * complete on our end. Close down the command window to
 		 * prevent the initiator from timing out commands.
 		 */
-		cnt = (c->c_cmds_active > 5) ? 0 : 5 - c->c_cmds_active;
+		cnt = (c->c_cmds_active >= c->c_maxcmdsn) ? 0 :
+		    (c->c_maxcmdsn - c->c_cmds_active) / 2;
 
 	} else {
 		cnt = (c->c_cmds_active >= c->c_maxcmdsn) ? 0 :
@@ -303,9 +305,8 @@
 void
 iscsi_cmd_delayed_store(iscsi_cmd_t *cmd, t10_cmd_t *t)
 {
-	iscsi_delayed_t	*d,
-			*n,
-			*l	= NULL;
+	iscsi_delayed_t	*d, *n;
+	iscsi_delayed_t	*l	= NULL;
 
 	if ((d = (iscsi_delayed_t *)calloc(1, sizeof (*d))) == NULL) {
 		syslog(LOG_ERR, "Failed to allocate space for delayed I/O");
--- a/usr/src/cmd/iscsi/iscsitgtd/util_queue.c	Fri May 23 11:34:29 2008 -0700
+++ b/usr/src/cmd/iscsi/iscsitgtd/util_queue.c	Fri May 23 12:19:20 2008 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -346,10 +346,13 @@
 	hrtime_t	h	= gethrtime();
 	hrtime_t	delta;
 	static hrtime_t	last_h	= 0;
+	time_t		tval = time((time_t *)0);
+	char		debug[80];
 
 	(void) pthread_mutex_lock(&q_mutex);
 	if ((qlog) && (qlog_lvl & lvl)) {
-		(void) fprintf(qlog, "%s", fmt);
+		ctime_r(&tval, debug, sizeof (debug));
+		(void) fprintf(qlog, "%s %s", debug, fmt);
 		(void) fflush(qlog);
 	}
 	(void) pthread_mutex_unlock(&q_mutex);