changeset 13759:32a39c8dbb42

653 incorrect handling in iscsit of duplicate PDUs with cmdsn > expsn Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Gary Mills <gary_mills@fastmail.fm> Reviewed by: Vitaliy Gusev <gusev.vitaliy@nexenta.com> Approved by: Garrett D'Amore <garrett@damore.org>
author Dan McDonald <danmcd@nexenta.com>
date Thu, 26 Jul 2012 12:14:58 -0400
parents 23432da34147
children 527f645bd884
files usr/src/uts/common/io/comstar/port/iscsit/iscsit.c
diffstat 1 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit.c	Wed Jul 25 19:05:31 2012 -0400
+++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit.c	Thu Jul 26 12:14:58 2012 -0400
@@ -20,9 +20,8 @@
  */
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ *
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  */
 
 #include <sys/cpuvar.h>
@@ -3161,9 +3160,21 @@
 	mutex_exit(&ict->ict_mutex);
 
 	index = ntohl(cmdsn) % ISCSIT_RXPDU_QUEUE_LEN;
-	ASSERT(cbuf->cb_buffer[index] == NULL);
-	cbuf->cb_buffer[index] = rx_pdu;
-	cbuf->cb_num_elems++;
+	/*
+	 * In the normal case, assuming that the Initiator is not
+	 * buggy and that we don't have packet duplication occuring,
+	 * the entry in the array will be NULL.  However, we may have
+	 * received a duplicate PDU with cmdsn > expsn , and in that
+	 * case we just ignore this PDU -- the previously received one
+	 * remains queued for processing.  We need to be careful not
+	 * to leak this one however.
+	 */
+	if (cbuf->cb_buffer[index] != NULL) {
+		idm_pdu_complete(rx_pdu, IDM_STATUS_FAIL);
+	} else {
+		cbuf->cb_buffer[index] = rx_pdu;
+		cbuf->cb_num_elems++;
+	}
 }
 
 static idm_pdu_t *