diff options
| -rw-r--r-- | fs/cifs/connect.c | 4 | ||||
| -rw-r--r-- | fs/cifs/smb2pdu.c | 27 |
2 files changed, 30 insertions, 1 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 66736f57b5ab..7d2b15c06090 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -428,7 +428,9 @@ cifs_echo_request(struct work_struct *work) | |||
| 428 | * server->ops->need_neg() == true. Also, no need to ping if | 428 | * server->ops->need_neg() == true. Also, no need to ping if |
| 429 | * we got a response recently. | 429 | * we got a response recently. |
| 430 | */ | 430 | */ |
| 431 | if (!server->ops->need_neg || server->ops->need_neg(server) || | 431 | |
| 432 | if (server->tcpStatus == CifsNeedReconnect || | ||
| 433 | server->tcpStatus == CifsExiting || server->tcpStatus == CifsNew || | ||
| 432 | (server->ops->can_echo && !server->ops->can_echo(server)) || | 434 | (server->ops->can_echo && !server->ops->can_echo(server)) || |
| 433 | time_before(jiffies, server->lstrp + echo_interval - HZ)) | 435 | time_before(jiffies, server->lstrp + echo_interval - HZ)) |
| 434 | goto requeue_echo; | 436 | goto requeue_echo; |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index c3e61a7a7c7c..29e06db5f187 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
| @@ -1812,6 +1812,33 @@ SMB2_echo(struct TCP_Server_Info *server) | |||
| 1812 | 1812 | ||
| 1813 | cifs_dbg(FYI, "In echo request\n"); | 1813 | cifs_dbg(FYI, "In echo request\n"); |
| 1814 | 1814 | ||
| 1815 | if (server->tcpStatus == CifsNeedNegotiate) { | ||
| 1816 | struct list_head *tmp, *tmp2; | ||
| 1817 | struct cifs_ses *ses; | ||
| 1818 | struct cifs_tcon *tcon; | ||
| 1819 | |||
| 1820 | cifs_dbg(FYI, "Need negotiate, reconnecting tcons\n"); | ||
| 1821 | spin_lock(&cifs_tcp_ses_lock); | ||
| 1822 | list_for_each(tmp, &server->smb_ses_list) { | ||
| 1823 | ses = list_entry(tmp, struct cifs_ses, smb_ses_list); | ||
| 1824 | list_for_each(tmp2, &ses->tcon_list) { | ||
| 1825 | tcon = list_entry(tmp2, struct cifs_tcon, | ||
| 1826 | tcon_list); | ||
| 1827 | /* add check for persistent handle reconnect */ | ||
| 1828 | if (tcon && tcon->need_reconnect) { | ||
| 1829 | spin_unlock(&cifs_tcp_ses_lock); | ||
| 1830 | rc = smb2_reconnect(SMB2_ECHO, tcon); | ||
| 1831 | spin_lock(&cifs_tcp_ses_lock); | ||
| 1832 | } | ||
| 1833 | } | ||
| 1834 | } | ||
| 1835 | spin_unlock(&cifs_tcp_ses_lock); | ||
| 1836 | } | ||
| 1837 | |||
| 1838 | /* if no session, renegotiate failed above */ | ||
| 1839 | if (server->tcpStatus == CifsNeedNegotiate) | ||
| 1840 | return -EIO; | ||
| 1841 | |||
| 1815 | rc = small_smb2_init(SMB2_ECHO, NULL, (void **)&req); | 1842 | rc = small_smb2_init(SMB2_ECHO, NULL, (void **)&req); |
| 1816 | if (rc) | 1843 | if (rc) |
| 1817 | return rc; | 1844 | return rc; |
