diff options
| -rw-r--r-- | fs/cifs/cifsglob.h | 1 | ||||
| -rw-r--r-- | fs/cifs/connect.c | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 4de737575959..9c728dd5b146 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
| @@ -218,6 +218,7 @@ struct TCP_Server_Info { | |||
| 218 | bool sec_kerberosu2u; /* supports U2U Kerberos */ | 218 | bool sec_kerberosu2u; /* supports U2U Kerberos */ |
| 219 | bool sec_ntlmssp; /* supports NTLMSSP */ | 219 | bool sec_ntlmssp; /* supports NTLMSSP */ |
| 220 | bool session_estab; /* mark when very first sess is established */ | 220 | bool session_estab; /* mark when very first sess is established */ |
| 221 | struct delayed_work echo; /* echo ping workqueue job */ | ||
| 221 | #ifdef CONFIG_CIFS_FSCACHE | 222 | #ifdef CONFIG_CIFS_FSCACHE |
| 222 | struct fscache_cookie *fscache; /* client index cache cookie */ | 223 | struct fscache_cookie *fscache; /* client index cache cookie */ |
| 223 | #endif | 224 | #endif |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index aa66de1db5f5..f38ca084c9d2 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -52,6 +52,9 @@ | |||
| 52 | #define CIFS_PORT 445 | 52 | #define CIFS_PORT 445 |
| 53 | #define RFC1001_PORT 139 | 53 | #define RFC1001_PORT 139 |
| 54 | 54 | ||
| 55 | /* SMB echo "timeout" -- FIXME: tunable? */ | ||
| 56 | #define SMB_ECHO_INTERVAL (60 * HZ) | ||
| 57 | |||
| 55 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, | 58 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, |
| 56 | unsigned char *p24); | 59 | unsigned char *p24); |
| 57 | 60 | ||
| @@ -333,6 +336,26 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) | |||
| 333 | 336 | ||
| 334 | } | 337 | } |
| 335 | 338 | ||
| 339 | static void | ||
| 340 | cifs_echo_request(struct work_struct *work) | ||
| 341 | { | ||
| 342 | int rc; | ||
| 343 | struct TCP_Server_Info *server = container_of(work, | ||
| 344 | struct TCP_Server_Info, echo.work); | ||
| 345 | |||
| 346 | /* no need to ping if we got a response recently */ | ||
| 347 | if (time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ)) | ||
| 348 | goto requeue_echo; | ||
| 349 | |||
| 350 | rc = CIFSSMBEcho(server); | ||
| 351 | if (rc) | ||
| 352 | cFYI(1, "Unable to send echo request to server: %s", | ||
| 353 | server->hostname); | ||
| 354 | |||
| 355 | requeue_echo: | ||
| 356 | queue_delayed_work(system_nrt_wq, &server->echo, SMB_ECHO_INTERVAL); | ||
| 357 | } | ||
| 358 | |||
| 336 | static int | 359 | static int |
| 337 | cifs_demultiplex_thread(struct TCP_Server_Info *server) | 360 | cifs_demultiplex_thread(struct TCP_Server_Info *server) |
| 338 | { | 361 | { |
| @@ -1571,6 +1594,8 @@ cifs_put_tcp_session(struct TCP_Server_Info *server) | |||
| 1571 | list_del_init(&server->tcp_ses_list); | 1594 | list_del_init(&server->tcp_ses_list); |
| 1572 | spin_unlock(&cifs_tcp_ses_lock); | 1595 | spin_unlock(&cifs_tcp_ses_lock); |
| 1573 | 1596 | ||
| 1597 | cancel_delayed_work_sync(&server->echo); | ||
| 1598 | |||
| 1574 | spin_lock(&GlobalMid_Lock); | 1599 | spin_lock(&GlobalMid_Lock); |
| 1575 | server->tcpStatus = CifsExiting; | 1600 | server->tcpStatus = CifsExiting; |
| 1576 | spin_unlock(&GlobalMid_Lock); | 1601 | spin_unlock(&GlobalMid_Lock); |
| @@ -1662,6 +1687,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) | |||
| 1662 | tcp_ses->sequence_number = 0; | 1687 | tcp_ses->sequence_number = 0; |
| 1663 | INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); | 1688 | INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); |
| 1664 | INIT_LIST_HEAD(&tcp_ses->smb_ses_list); | 1689 | INIT_LIST_HEAD(&tcp_ses->smb_ses_list); |
| 1690 | INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request); | ||
| 1665 | 1691 | ||
| 1666 | /* | 1692 | /* |
| 1667 | * at this point we are the only ones with the pointer | 1693 | * at this point we are the only ones with the pointer |
| @@ -1710,6 +1736,9 @@ cifs_get_tcp_session(struct smb_vol *volume_info) | |||
| 1710 | 1736 | ||
| 1711 | cifs_fscache_get_client_cookie(tcp_ses); | 1737 | cifs_fscache_get_client_cookie(tcp_ses); |
| 1712 | 1738 | ||
| 1739 | /* queue echo request delayed work */ | ||
| 1740 | queue_delayed_work(system_nrt_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL); | ||
| 1741 | |||
| 1713 | return tcp_ses; | 1742 | return tcp_ses; |
| 1714 | 1743 | ||
| 1715 | out_err_crypto_release: | 1744 | out_err_crypto_release: |
