diff options
author | Steve French <sfrench@us.ibm.com> | 2011-04-11 21:01:14 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-04-11 21:01:14 -0400 |
commit | fd88ce9313e9f9d3b56eada7fc76a301828baefd (patch) | |
tree | da6f5ec8cbb639b68ed68d22ab3d879b51550f42 /fs/cifs/connect.c | |
parent | 157c249114508aa71daa308a426e15d81a4eed00 (diff) |
[CIFS] cifs: clarify the meaning of tcpStatus == CifsGood
When the TCP_Server_Info is first allocated and connected, tcpStatus ==
CifsGood means that the NEGOTIATE_PROTOCOL request has completed and the
socket is ready for other calls. cifs_reconnect however sets tcpStatus
to CifsGood as soon as the socket is reconnected and the optional
RFC1001 session setup is done. We have no clear way to tell the
difference between these two states, and we need to know this in order
to know whether we can send an echo or not.
Resolve this by adding a new statusEnum value -- CifsNeedNegotiate. When
the socket has been connected but has not yet had a NEGOTIATE_PROTOCOL
request done, set it to this value. Once the NEGOTIATE is done,
cifs_negotiate_protocol will set tcpStatus to CifsGood.
This also fixes and cleans the logic in cifs_reconnect and
cifs_reconnect_tcon. The old code checked for specific states when what
it really wants to know is whether the state has actually changed from
CifsNeedReconnect.
Reported-and-Tested-by: JG <jg@cms.ac>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 709fd9d9b78f..8cf4a63a36d5 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -199,8 +199,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
199 | } | 199 | } |
200 | spin_unlock(&GlobalMid_Lock); | 200 | spin_unlock(&GlobalMid_Lock); |
201 | 201 | ||
202 | while ((server->tcpStatus != CifsExiting) && | 202 | while (server->tcpStatus == CifsNeedReconnect) { |
203 | (server->tcpStatus != CifsGood)) { | ||
204 | try_to_freeze(); | 203 | try_to_freeze(); |
205 | 204 | ||
206 | /* we should try only the port we connected to before */ | 205 | /* we should try only the port we connected to before */ |
@@ -212,7 +211,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
212 | atomic_inc(&tcpSesReconnectCount); | 211 | atomic_inc(&tcpSesReconnectCount); |
213 | spin_lock(&GlobalMid_Lock); | 212 | spin_lock(&GlobalMid_Lock); |
214 | if (server->tcpStatus != CifsExiting) | 213 | if (server->tcpStatus != CifsExiting) |
215 | server->tcpStatus = CifsGood; | 214 | server->tcpStatus = CifsNeedNegotiate; |
216 | spin_unlock(&GlobalMid_Lock); | 215 | spin_unlock(&GlobalMid_Lock); |
217 | } | 216 | } |
218 | } | 217 | } |
@@ -421,7 +420,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
421 | pdu_length = 4; /* enough to get RFC1001 header */ | 420 | pdu_length = 4; /* enough to get RFC1001 header */ |
422 | 421 | ||
423 | incomplete_rcv: | 422 | incomplete_rcv: |
424 | if (echo_retries > 0 && | 423 | if (echo_retries > 0 && server->tcpStatus == CifsGood && |
425 | time_after(jiffies, server->lstrp + | 424 | time_after(jiffies, server->lstrp + |
426 | (echo_retries * SMB_ECHO_INTERVAL))) { | 425 | (echo_retries * SMB_ECHO_INTERVAL))) { |
427 | cERROR(1, "Server %s has not responded in %d seconds. " | 426 | cERROR(1, "Server %s has not responded in %d seconds. " |
@@ -1766,6 +1765,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) | |||
1766 | module_put(THIS_MODULE); | 1765 | module_put(THIS_MODULE); |
1767 | goto out_err_crypto_release; | 1766 | goto out_err_crypto_release; |
1768 | } | 1767 | } |
1768 | tcp_ses->tcpStatus = CifsNeedNegotiate; | ||
1769 | 1769 | ||
1770 | /* thread spawned, put it on the list */ | 1770 | /* thread spawned, put it on the list */ |
1771 | spin_lock(&cifs_tcp_ses_lock); | 1771 | spin_lock(&cifs_tcp_ses_lock); |