Blob Blame Raw
diff -aurp open-iscsi-2.0-868-test1.orig/usr/discovery.c open-iscsi-2.0-868-test1/usr/discovery.c
--- open-iscsi-2.0-868-test1.orig/usr/discovery.c	2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/discovery.c	2008-01-23 12:14:25.000000000 -0600
@@ -981,7 +981,6 @@ redirect_reconnect:
 		break;
 
 	case LOGIN_IO_ERROR:
-	case LOGIN_WRONG_PORTAL_GROUP:
 	case LOGIN_REDIRECTION_FAILED:
 		/* try again */
 		log_warning("retrying discovery login to %s", host);
diff -aurp open-iscsi-2.0-868-test1.orig/usr/initiator.c open-iscsi-2.0-868-test1/usr/initiator.c
--- open-iscsi-2.0-868-test1.orig/usr/initiator.c	2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/initiator.c	2008-01-23 12:14:25.000000000 -0600
@@ -149,7 +149,6 @@ __login_response_status(iscsi_conn_t *co
 	case LOGIN_REDIRECT:
 		return CONN_LOGIN_IMM_REDIRECT_RETRY;
 	case LOGIN_IO_ERROR:
-	case LOGIN_WRONG_PORTAL_GROUP:
 	case LOGIN_REDIRECTION_FAILED:
 		return CONN_LOGIN_RETRY;
 	default:
diff -aurp open-iscsi-2.0-868-test1.orig/usr/initiator.h open-iscsi-2.0-868-test1/usr/initiator.h
--- open-iscsi-2.0-868-test1.orig/usr/initiator.h	2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/initiator.h	2008-01-23 12:14:25.000000000 -0600
@@ -75,10 +75,9 @@ enum iscsi_login_status {
 	LOGIN_VERSION_MISMATCH		= 3,
 	LOGIN_NEGOTIATION_FAILED	= 4,
 	LOGIN_AUTHENTICATION_FAILED	= 5,
-	LOGIN_WRONG_PORTAL_GROUP	= 6,
-	LOGIN_REDIRECTION_FAILED	= 7,
-	LOGIN_INVALID_PDU		= 8,
-	LOGIN_REDIRECT			= 9,
+	LOGIN_REDIRECTION_FAILED	= 6,
+	LOGIN_INVALID_PDU		= 7,
+	LOGIN_REDIRECT			= 8,
 };
 
 typedef enum iscsi_event_e {
diff -aurp open-iscsi-2.0-868-test1.orig/usr/login.c open-iscsi-2.0-868-test1/usr/login.c
--- open-iscsi-2.0-868-test1.orig/usr/login.c	2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/login.c	2008-01-23 12:14:25.000000000 -0600
@@ -264,24 +264,20 @@ get_security_text_keys(iscsi_session_t *
 					 &value, &value_end)) {
 		/*
 		 * We should have already obtained this
-		 * via discovery.
-		 * We've already picked an isid, so the
-		 * most we can do is confirm we reached
-		 * the portal group we were expecting to
+		 * via discovery, but the value could be stale.
+		 * If the target was reconfigured it will send us
+		 * the updated tpgt.
 		 */
 		tag = strtoul(value, NULL, 0);
 		if (session->portal_group_tag >= 0) {
-			if (tag != session->portal_group_tag) {
-				log_error("Portal group tag "
+			if (tag != session->portal_group_tag)
+				log_debug(2, "Portal group tag "
 					  "mismatch, expected %u, "
-					  "received %u",
+					  "received %u. Updating",
 					  session->portal_group_tag, tag);
-				return LOGIN_WRONG_PORTAL_GROUP;
-			}
-		} else
-			/* we now know the tag */
-			session->portal_group_tag = tag;
-
+		}
+		/* we now know the tag */
+		session->portal_group_tag = tag;
 		text = value_end;
 	} else {
 		/*
@@ -339,21 +335,22 @@ get_op_params_text_keys(iscsi_session_t 
 		}
 	} else if (iscsi_find_key_value("TargetPortalGroupTag", text, end,
 					 &value, &value_end)) {
+		int tag = strtoul(value, NULL, 0);
 		/*
-		 * confirm we reached the portal group we were expecting to
+		 * We should have already obtained this
+		 * via discovery, but the value could be stale.
+		 * If the target was reconfigured it will send us
+		 * the updated tpgt.
 		 */
-		int tag = strtoul(value, NULL, 0);
 		if (session->portal_group_tag >= 0) {
-			if (tag != session->portal_group_tag) {
-				log_error("Portal group tag mismatch, "
-					  "expected %u, received %u",
+			if (tag != session->portal_group_tag)
+				log_debug(2, "Portal group tag "
+					  "mismatch, expected %u, "
+					  "received %u. Updating",
 					  session->portal_group_tag, tag);
-				return LOGIN_WRONG_PORTAL_GROUP;
-			}
-		} else
-			/* we now know the tag */
-			session->portal_group_tag = tag;
-
+		}
+		/* we now know the tag */
+		session->portal_group_tag = tag;
 		text = value_end;
 	} else if (iscsi_find_key_value("InitialR2T", text, end, &value,
 					 &value_end)) {