|
@@ -178,6 +178,18 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
|
|
|
* reconnect the same SMB session
|
|
|
*/
|
|
|
mutex_lock(&ses->session_mutex);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Recheck after acquire mutex. If another thread is negotiating
|
|
|
+ * and the server never sends an answer the socket will be closed
|
|
|
+ * and tcpStatus set to reconnect.
|
|
|
+ */
|
|
|
+ if (server->tcpStatus == CifsNeedReconnect) {
|
|
|
+ rc = -EHOSTDOWN;
|
|
|
+ mutex_unlock(&ses->session_mutex);
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
+
|
|
|
rc = cifs_negotiate_protocol(0, ses);
|
|
|
if (rc == 0 && ses->need_reconnect)
|
|
|
rc = cifs_setup_session(0, ses, nls_codepage);
|