changeset 10774:72b99c06d75b

6861142 iscsi initiator ASSERT fail when static configured target's IP:port address is all 0 6872036 iscsi initiator with isns-server discovery cannot handle non-default portals (NULL PGT) 6875424 False to load backup iscsi persistent file iscsi_v1.dbp
author yi zhang - Sun Microsystems - Beijing China <Zhang.Yi@Sun.COM>
date Tue, 13 Oct 2009 09:49:38 +0800
parents 434ca1ce22f9
children a6efb446630f
files usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c usr/src/uts/common/io/scsi/adapters/iscsi/isns_client.c usr/src/uts/common/io/scsi/adapters/iscsi/nvfile.c usr/src/uts/common/io/scsi/adapters/iscsi/persistent.c
diffstat 4 files changed, 35 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c	Mon Oct 12 21:46:24 2009 -0400
+++ b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.c	Tue Oct 13 09:49:38 2009 +0800
@@ -2589,7 +2589,8 @@
 			break;
 		}
 
-		if (target->te_entry.e_vers != ISCSI_INTERFACE_VERSION) {
+		if ((target->te_entry.e_vers != ISCSI_INTERFACE_VERSION) ||
+		    (target->te_entry.e_insize == 0)) {
 			kmem_free(target, sizeof (*target));
 			rtn = EINVAL;
 			break;
@@ -2675,7 +2676,8 @@
 		if (ddi_copyin((caddr_t)arg, &e, sizeof (e), mode)) {
 			rtn = EFAULT;
 			break;
-		} else if (e.e_vers != ISCSI_INTERFACE_VERSION) {
+		} else if ((e.e_vers != ISCSI_INTERFACE_VERSION) ||
+		    (e.e_insize == 0)) {
 			rtn = EINVAL;
 			break;
 		}
--- a/usr/src/uts/common/io/scsi/adapters/iscsi/isns_client.c	Mon Oct 12 21:46:24 2009 -0400
+++ b/usr/src/uts/common/io/scsi/adapters/iscsi/isns_client.c	Tue Oct 13 09:49:38 2009 +0800
@@ -2505,7 +2505,18 @@
 			}
 		} else if (ntohl(attr_tlv_p->attr_id) ==
 		    ISNS_PG_TAG_ATTR_ID) {
-			num_of_pgs++;
+			if (ntohl(attr_tlv_p->attr_len) > 0) {
+				/*
+				 * Count only those iSCSI node that have a
+				 * non-NULL PGT value as valid Entity.
+				 * Per rfc4171 section 3.4 - If the PGT value
+				 * registered for a specified Portal and iSCSI
+				 * Node is NULL, or if no PGT value is
+				 * registered, then the Portal does not provide
+				 * access to that iSCSI Node in the Entity.
+				 */
+				num_of_pgs++;
+			}
 		}
 		len = ntohl(attr_tlv_p->attr_len);
 
@@ -2649,8 +2660,15 @@
 					    (*attr_tlv_p).
 					    attr_value);
 				}
-				(*pg_list)->pg_out_cnt++;
 				target_node_type_b = B_FALSE;
+				if (ntohl(attr_tlv_p->attr_len) > 0) {
+					/*
+					 * Only the iSCSI node that has a
+					 * non-NULL PGT value is an valid
+					 * Entity.
+					 */
+					(*pg_list)->pg_out_cnt++;
+				}
 				break;
 
 			default:
--- a/usr/src/uts/common/io/scsi/adapters/iscsi/nvfile.c	Mon Oct 12 21:46:24 2009 -0400
+++ b/usr/src/uts/common/io/scsi/adapters/iscsi/nvfile.c	Tue Oct 13 09:49:38 2009 +0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -235,7 +235,7 @@
 		mutex_exit(&nvf_lock);
 		return (B_TRUE);
 	} else {
-		rval = nvf_parse(nvf_curr_filename);
+		rval = nvf_parse(nvf_prev_filename);
 	}
 
 	if (rval == B_TRUE) {
--- a/usr/src/uts/common/io/scsi/adapters/iscsi/persistent.c	Mon Oct 12 21:46:24 2009 -0400
+++ b/usr/src/uts/common/io/scsi/adapters/iscsi/persistent.c	Tue Oct 13 09:49:38 2009 +0800
@@ -167,6 +167,11 @@
 			curr_count++;
 		}
 
+		/* Skip the target whose address size length is 0 */
+		if (e.e_insize == 0) {
+			continue;
+		}
+
 		mutex_enter(&iscsi_oid_mutex);
 		e.e_oid = iscsi_oid++;
 		mutex_exit(&iscsi_oid_mutex);
@@ -213,6 +218,10 @@
 				continue;
 			}
 			*c_end = '\0';
+			/* Skip the target whose address size length is 0 */
+			if (e.e_insize == 0) {
+				continue;
+			}
 			/* Add updated record */
 			(void) persistent_static_addr_set(target_name, &e);
 		}