changeset 11096:1f03915dd9c3

6901087 cluster head panicked in "stmf_ic_scsi_cmd_msg_all" while backup job was executing
author John Forte <John.Forte@Sun.COM>
date Wed, 18 Nov 2009 22:01:33 -0800
parents 4726a45b3bb2
children 1dfc844e3407
files usr/src/uts/common/io/comstar/port/pppt/alua_ic_if.c usr/src/uts/common/io/comstar/stmf/stmf.c
diffstat 2 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/comstar/port/pppt/alua_ic_if.c	Wed Nov 18 14:15:11 2009 -0800
+++ b/usr/src/uts/common/io/comstar/port/pppt/alua_ic_if.c	Wed Nov 18 22:01:33 2009 -0800
@@ -629,7 +629,6 @@
 	stmf_ic_scsi_cmd_msg_t *icsc = NULL;
 	scsi_devid_desc_t *ini_devid = task->task_session->ss_rport_id;
 	scsi_devid_desc_t *tgt_devid = task->task_lport->lport_id;
-	uint8_t *lun_id = task->task_lu->lu_id->ident;
 
 	icm = stmf_ic_alloc_msg_header(STMF_ICM_SCSI_CMD, msgid);
 	icsc = (stmf_ic_scsi_cmd_msg_t *)kmem_zalloc(sizeof (*icsc), KM_SLEEP);
@@ -640,7 +639,10 @@
 	icsc->icsc_tgt_devid = scsi_devid_desc_dup(tgt_devid);
 	icsc->icsc_session_id = task->task_session->ss_session_id;
 
-	bcopy(lun_id, icsc->icsc_lun_id, sizeof (icsc->icsc_lun_id));
+	if (!task->task_mgmt_function && task->task_lu->lu_id) {
+		bcopy(task->task_lu->lu_id->ident,
+		    icsc->icsc_lun_id, sizeof (icsc->icsc_lun_id));
+	}
 
 	bcopy(task->task_lun_no, icsc->icsc_task_lun_no,
 	    sizeof (icsc->icsc_task_lun_no));
--- a/usr/src/uts/common/io/comstar/stmf/stmf.c	Wed Nov 18 14:15:11 2009 -0800
+++ b/usr/src/uts/common/io/comstar/stmf/stmf.c	Wed Nov 18 22:01:33 2009 -0800
@@ -51,6 +51,7 @@
 static uint16_t stmf_rtpid_counter = 0;
 /* start messages at 1 */
 static uint64_t stmf_proxy_msg_id = 1;
+#define	MSG_ID_TM_BIT	0x8000000000000000
 
 static int stmf_attach(dev_info_t *dip, ddi_attach_cmd_t cmd);
 static int stmf_detach(dev_info_t *dip, ddi_detach_cmd_t cmd);
@@ -1654,6 +1655,11 @@
 {
 	scsi_task_t *task;
 
+	/* is this a task management command */
+	if (msg->icss_task_msgid & MSG_ID_TM_BIT) {
+		return (STMF_SUCCESS);
+	}
+
 	task = find_task_from_msgid(msg->icss_lun_id, msg->icss_task_msgid);
 
 	if (task == NULL) {
@@ -1680,6 +1686,11 @@
 	stmf_data_buf_t *dbuf;
 	uint32_t sz, minsz, xd_sz, asz;
 
+	/* is this a task management command */
+	if (msg->icsd_task_msgid & MSG_ID_TM_BIT) {
+		return (STMF_SUCCESS);
+	}
+
 	task = find_task_from_msgid(msg->icsd_lun_id, msg->icsd_task_msgid);
 	if (task == NULL) {
 		stmf_ic_msg_t *ic_xfer_done_msg = NULL;
@@ -1780,9 +1791,17 @@
 	/*
 	 * stmf will now take over the task handling for this task
 	 * but it still needs to be treated differently from other
-	 * default handled tasks, hence the ITASK_PROXY_TASK
+	 * default handled tasks, hence the ITASK_PROXY_TASK.
+	 * If this is a task management function, we're really just
+	 * duping the command to the peer. Set the TM bit so that
+	 * we can recognize this on return since we won't be completing
+	 * the proxied task in that case.
 	 */
-	itask->itask_flags |= ITASK_DEFAULT_HANDLING | ITASK_PROXY_TASK;
+	if (task->task_mgmt_function) {
+		itask->itask_proxy_msg_id |= MSG_ID_TM_BIT;
+	} else {
+		itask->itask_flags |= ITASK_DEFAULT_HANDLING | ITASK_PROXY_TASK;
+	}
 	if (dbuf) {
 		ic_cmd_msg = ic_scsi_cmd_msg_alloc(itask->itask_proxy_msg_id,
 		    task, dbuf->db_data_size, dbuf->db_sglist[0].seg_addr,
@@ -6314,7 +6333,6 @@
 	int i;
 	uint8_t map;
 
-	ASSERT(abort_cmd == STMF_LU_ABORT_TASK);
 	if ((task->task_mgmt_function) && (itask->itask_flags &
 	    (ITASK_CAUSING_LU_RESET | ITASK_CAUSING_TARGET_RESET))) {
 		switch (task->task_mgmt_function) {