summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2006-12-21 18:43:43 +0100
committerMichael Brown2006-12-21 18:43:43 +0100
commit6ceb55fad0a95be0fc9926a3f528503c0ec3e506 (patch)
tree15a245ea296d87fc6e8ba189edc9f4d9a175b7e5 /src
parentUse a bigger buffer for the initiator IQN (diff)
downloadipxe-6ceb55fad0a95be0fc9926a3f528503c0ec3e506.tar.gz
ipxe-6ceb55fad0a95be0fc9926a3f528503c0ec3e506.tar.xz
ipxe-6ceb55fad0a95be0fc9926a3f528503c0ec3e506.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/net/tcp/iscsi.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c
index 59b8819a..4897f1e2 100644
--- a/src/net/tcp/iscsi.c
+++ b/src/net/tcp/iscsi.c
@@ -727,8 +727,8 @@ static void iscsi_rx_login_response ( struct iscsi_session *iscsi, void *data,
/* Check for fatal errors */
if ( response->status_class != 0 ) {
- printf ( "iSCSI login failure: class %02x detail %02x\n",
- response->status_class, response->status_detail );
+ DBG ( "iSCSI login failure: class %02x detail %02x\n",
+ response->status_class, response->status_detail );
iscsi_done ( iscsi, -EPERM );
return;
}
@@ -1172,9 +1172,20 @@ struct async_operation * iscsi_issue ( struct iscsi_session *iscsi,
iscsi->command = command;
if ( iscsi->status ) {
- iscsi_start_command ( iscsi );
- tcp_senddata ( &iscsi->tcp );
+ if ( ( iscsi->status & ISCSI_STATUS_PHASE_MASK ) ==
+ ISCSI_STATUS_FULL_FEATURE_PHASE ) {
+ /* Session already open: issue command */
+ iscsi_start_command ( iscsi );
+ tcp_senddata ( &iscsi->tcp );
+ } else {
+ /* Session failed to reach full feature phase:
+ * abort immediately rather than retrying the
+ * login.
+ */
+ iscsi_done ( iscsi, -EPERM );
+ }
} else {
+ /* Session not open: initiate login */
iscsi->tcp.tcp_op = &iscsi_tcp_operations;
tcp_connect ( &iscsi->tcp );
}