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