Browse Source

When login fails, leave the session open but not in full feature

phase.  In iscsi_issue(), detect this state and immediately refuse the
operation.  This avoids trying multiple logins when scsi.c tries
several times to read the drive capacity.
tags/v0.9.3
Michael Brown 18 years ago
parent
commit
6ceb55fad0
1 changed files with 15 additions and 4 deletions
  1. 15
    4
      src/net/tcp/iscsi.c

+ 15
- 4
src/net/tcp/iscsi.c View File

727
 
727
 
728
 	/* Check for fatal errors */
728
 	/* Check for fatal errors */
729
 	if ( response->status_class != 0 ) {
729
 	if ( response->status_class != 0 ) {
730
-		printf ( "iSCSI login failure: class %02x detail %02x\n",
731
-			 response->status_class, response->status_detail );
730
+		DBG ( "iSCSI login failure: class %02x detail %02x\n",
731
+		      response->status_class, response->status_detail );
732
 		iscsi_done ( iscsi, -EPERM );
732
 		iscsi_done ( iscsi, -EPERM );
733
 		return;
733
 		return;
734
 	}
734
 	}
1172
 	iscsi->command = command;
1172
 	iscsi->command = command;
1173
 
1173
 
1174
 	if ( iscsi->status ) {
1174
 	if ( iscsi->status ) {
1175
-		iscsi_start_command ( iscsi );
1176
-		tcp_senddata ( &iscsi->tcp );
1175
+		if ( ( iscsi->status & ISCSI_STATUS_PHASE_MASK ) ==
1176
+		     ISCSI_STATUS_FULL_FEATURE_PHASE ) {
1177
+			/* Session already open: issue command */
1178
+			iscsi_start_command ( iscsi );
1179
+			tcp_senddata ( &iscsi->tcp );
1180
+		} else {
1181
+			/* Session failed to reach full feature phase:
1182
+			 * abort immediately rather than retrying the
1183
+			 * login.
1184
+			 */
1185
+			iscsi_done ( iscsi, -EPERM );
1186
+		}
1177
 	} else {
1187
 	} else {
1188
+		/* Session not open: initiate login */
1178
 		iscsi->tcp.tcp_op = &iscsi_tcp_operations;
1189
 		iscsi->tcp.tcp_op = &iscsi_tcp_operations;
1179
 		tcp_connect ( &iscsi->tcp );
1190
 		tcp_connect ( &iscsi->tcp );
1180
 	}
1191
 	}

Loading…
Cancel
Save