cifs: Make echo interval tunable.
Subsystems (2)
PATCH 1/1 cifs: Make echo interval tunable.
Currently the echo interval is set to 60 seconds using a macro. This setting determines the interval at which echo requests are sent to the server on an idling connection. This setting also affects the time required for a connection to an unresponsive server to timeout.
Making this setting a tunable allows users to control the echo interval times as well as control the time after which the connecting to an unresponsive server times out.
--- fs/cifs/cifsfs.c | 2 ++ fs/cifs/cifsglob.h | 8 ++++++-- fs/cifs/connect.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 35 insertions(+), 8 deletions(-)
fs/cifs/cifsfs.c +2 -0
@@ -507,6 +507,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)seq_printf (s,",rsize=%u" , cifs_sb->rsize);seq_printf (s,",wsize=%u" , cifs_sb->wsize); +seq_printf (s,",echo_interval=%lu" , + tcon->ses->server->echo_interval /HZ );/* convert actimeo and display it in seconds */ seq_printf (s,",actimeo=%lu" , cifs_sb->actimeo /HZ );
fs/cifs/cifsglob.h +6 -2
@@ -70,8 +70,10 @@#define SERVER_NAME_LENGTH 40#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) -/* SMB echo "timeout" -- FIXME: tunable? */ -#define SMB_ECHO_INTERVAL (60 * HZ) +/* echo interval in seconds */ +#define SMB_ECHO_INTERVAL_MIN 10 +#define SMB_ECHO_INTERVAL_MAX 120 +#define SMB_ECHO_INTERVAL_DEFAULT 60#include "cifspdu.h"
@@ -507,6 +509,7 @@ struct smb_vol {struct sockaddr_storage dstaddr;/* destination address */ struct sockaddr_storage srcaddr;/* allow binding to a local IP */ struct nls_table *local_nls; +unsigned int echo_interval;/* echo interval in secs */ };#define CIFS_MOUNT_MASK (CIFS_MOUNT_NO_PERM | CIFS_MOUNT_SET_UID | \
@@ -628,6 +631,7 @@ struct TCP_Server_Info {unsigned int max_read;unsigned int max_write;#endif /* CONFIG_CIFS_SMB2 */ +unsigned long echo_interval; }; static inline unsigned int
fs/cifs/connect.c +27 -6
@@ -95,6 +95,7 @@ enum { Opt_cruid, Opt_gid, Opt_file_mode, Opt_dirmode, Opt_port, Opt_rsize, Opt_wsize, Opt_actimeo, + Opt_echo_interval,/* Mount options which take string value */ Opt_user, Opt_pass, Opt_ip,
@@ -188,6 +189,7 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_rsize, "rsize=%s" }, { Opt_wsize, "wsize=%s" }, { Opt_actimeo, "actimeo=%s" }, + { Opt_echo_interval, "echo_interval=%s" }, { Opt_blank_user, "user=" }, { Opt_blank_user, "username=" },
@@ -418,6 +420,7 @@ cifs_echo_request(struct work_struct *work)int rc;struct TCP_Server_Info *server =container_of (work, struct TCP_Server_Info, echo.work); +unsigned long echo_interval = server->echo_interval;/* * We cannot send an echo if it is disabled or until the
@@ -427,7 +430,7 @@ cifs_echo_request(struct work_struct *work)*/ if (!server->ops->need_neg || server->ops->need_neg (server) || (server->ops->can_echo && !server->ops->can_echo (server)) || -time_before (jiffies, server->lstrp +SMB_ECHO_INTERVAL -HZ )) +time_before (jiffies, server->lstrp + echo_interval -HZ )) goto requeue_echo; rc = server->ops->echo ? server->ops->echo (server) : -ENOSYS ;
@@ -436,7 +439,7 @@ cifs_echo_request(struct work_struct *work) server->hostname); requeue_echo: -queue_delayed_work (cifsiod_wq, &server->echo,SMB_ECHO_INTERVAL ); +queue_delayed_work (cifsiod_wq, &server->echo, echo_interval); } static bool
@@ -487,9 +490,9 @@ server_unresponsive(struct TCP_Server_Info *server)* a response in >60s. */ if (server->tcpStatus == CifsGood && -time_after (jiffies, server->lstrp +2 *SMB_ECHO_INTERVAL )) { -cifs_dbg (VFS ,"Server %s has not responded in %d seconds. Reconnecting...\n" , - server->hostname, (2 *SMB_ECHO_INTERVAL ) /HZ ); +time_after (jiffies, server->lstrp +2 * server->echo_interval)) { +cifs_dbg (VFS ,"Server %s has not responded in %lu seconds. Reconnecting...\n" , + server->hostname, (2 * server->echo_interval) /HZ );cifs_reconnect (server);wake_up (&server->response_q);return true;
@@ -1624,6 +1627,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, goto cifs_parse_mount_err; }break ; +case Opt_echo_interval: +if (get_option_ul (args, &option)) { +cifs_dbg (VFS ,"%s: Invalid echo interval value\n" , + __func__); + goto cifs_parse_mount_err; + } + vol->echo_interval = option; +break ;/* String Arguments */
@@ -2089,6 +2100,9 @@ static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol)if (!match_security (server, vol))return 0 ; +if (server->echo_interval != vol->echo_interval) +return 0 ; +return 1 ; }
@@ -2208,6 +2222,13 @@ cifs_get_tcp_session(struct smb_vol *volume_info) tcp_ses->tcpStatus = CifsNew; ++tcp_ses->srv_count; +/* echo interval should be between 10 and 120 secs */ +if (volume_info->echo_interval >SMB_ECHO_INTERVAL_MIN || + volume_info->echo_interval <SMB_ECHO_INTERVAL_MAX ) + tcp_ses->echo_interval = volume_info->echo_interval *HZ ; +else + tcp_ses->echo_interval =SMB_ECHO_INTERVAL_DEFAULT *HZ ; + rc =ip_connect (tcp_ses);if (rc <0 ) {cifs_dbg (VFS ,"Error connecting to socket. Aborting operation.\n" );
@@ -2237,7 +2258,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)cifs_fscache_get_client_cookie (tcp_ses);/* queue echo request delayed work */ -queue_delayed_work (cifsiod_wq, &tcp_ses->echo,SMB_ECHO_INTERVAL ); +queue_delayed_work (cifsiod_wq, &tcp_ses->echo, tcp_ses->echo_interval);return tcp_ses;
Signature · 1 line
2.4.3
A message that is not in the archive (sent off-list or not yet received): 1450097226-20815-1-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Another approach as pointed to by Jeff Layton is to make it a module parameter which is then set for all shares mounted on the client.
Any comments on the patch are welcome.
Sachin Prabhu
Quoted 199 lines · Sachin Prabhu
Currently the echo interval is set to 60 seconds using a macro. This setting determines the interval at which echo requests are sent to the
server on an idling connection. This setting also affects the time required for a connection to an unresponsive server to timeout.Making this setting a tunable allows users to control the echo interval
times as well as control the time after which the connecting to an unresponsive server times out.Signed-off-by Sachin Prabhu <[email protected]>--- fs/cifs/cifsfs.c | 2 ++ fs/cifs/cifsglob.h | 8 ++++++-- fs/cifs/connect.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 35 insertions(+), 8 deletions(-)fs/cifs/cifsfs.c +2
-0@@ -507,6 +507,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) seq_printf(s, ",rsize=%u", cifs_sb->rsize);seq_printf (s,",wsize=%u" , cifs_sb->wsize); +seq_printf (s,",echo_interval=%lu" , + tcon->ses->server->echo_interval /HZ );/* convert actimeo and display it in seconds */ seq_printf (s,",actimeo=%lu" , cifs_sb->actimeo /HZ );fs/cifs/cifsglob.h +4
-2@@ -70,8 +70,10 @@#define SERVER_NAME_LENGTH 40#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) -/* SMB echo "timeout" -- FIXME: tunable? */ -#define SMB_ECHO_INTERVAL (60 * HZ) +/* echo interval in seconds */ +#define SMB_ECHO_INTERVAL_MIN 10 +#define SMB_ECHO_INTERVAL_MAX 120 +#define SMB_ECHO_INTERVAL_DEFAULT 60#include "cifspdu.h" @@ -507,6 +509,7 @@ struct smb_vol {struct sockaddr_storage dstaddr;/* destination address */ struct sockaddr_storage srcaddr;/* allow binding to a local IP */
fs/cifs/cifsglob.h +2
-0struct nls_table *local_nls; +unsigned int echo_interval;/* echo interval in secs */ };#define CIFS_MOUNT_MASK (CIFS_MOUNT_NO_PERM | CIFS_MOUNT_SET_UID | \@@ -628,6 +631,7 @@ struct TCP_Server_Info {unsigned int max_read;unsigned int max_write;#endif /* CONFIG_CIFS_SMB2 */ +unsigned long echo_interval; }; static inline unsigned intfs/cifs/connect.c +2
-0@@ -95,6 +95,7 @@ enum { Opt_cruid, Opt_gid, Opt_file_mode, Opt_dirmode, Opt_port, Opt_rsize, Opt_wsize, Opt_actimeo, + Opt_echo_interval,/* Mount options which take string value */ Opt_user, Opt_pass, Opt_ip,@@ -188,6 +189,7 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_rsize, "rsize=%s" }, { Opt_wsize, "wsize=%s" }, { Opt_actimeo, "actimeo=%s" }, + { Opt_echo_interval, "echo_interval=%s" }, { Opt_blank_user, "user=" },fs/cifs/connect.c +1
-0{ Opt_blank_user, "username=" },@@ -418,6 +420,7 @@ cifs_echo_request(struct work_struct *work)int rc;struct TCP_Server_Info *server =container_of (work, struct TCP_Server_Info, echo.work); +unsigned long echo_interval = server->echo_interval;/* fs/cifs/connect.c +0
-0* We cannot send an echo if it is disabled or until the @@ -427,7 +430,7 @@ cifs_echo_request(struct work_struct *work)*/ if (!server->ops->need_neg || server->ops->need_neg(server)||
fs/cifs/connect.c +0
-2(server->ops->can_echo && !server->ops ->can_echo (server)) || - time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL -HZ))
fs/cifs/connect.c +1
-0+ time_before(jiffies, server->lstrp + echo_interval -HZ))
fs/cifs/connect.c +1
-2goto requeue_echo; rc = server->ops->echo ? server->ops->echo(server) : -ENOSYS ;@@ -436,7 +439,7 @@ cifs_echo_request(struct work_struct *work) server->hostname); requeue_echo: -queue_delayed_work (cifsiod_wq, &server->echo, SMB_ECHO_INTERVAL); +queue_delayed_work (cifsiod_wq, &server->echo, echo_interval); }static bool
fs/cifs/connect.c +0
-3@@ -487,9 +490,9 @@ server_unresponsive(struct TCP_Server_Info*server) * a response in >60s. */ if (server->tcpStatus == CifsGood && -time_after (jiffies, server->lstrp +2 * SMB_ECHO_INTERVAL)) { - cifs_dbg(VFS, "Server %s has not responded in %d seconds. Reconnecting...\n", - server->hostname, (2 * SMB_ECHO_INTERVAL) /HZ);
fs/cifs/connect.c +2
-1+ time_after(jiffies, server->lstrp + 2 * server ->echo_interval)) { + cifs_dbg(VFS, "Server %s has not responded in %luseconds. Reconnecting...\n",
fs/cifs/connect.c +9
-1+ server->hostname, (2 * server ->echo_interval) / HZ); cifs_reconnect(server);wake_up (&server->response_q);return true;@@ -1624,6 +1627,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, goto cifs_parse_mount_err; }break ; +case Opt_echo_interval: +if (get_option_ul (args, &option)) { + cifs_dbg(VFS, "%s: Invalid echo interval value\n", + __func__); + goto cifs_parse_mount_err; + } + vol->echo_interval = option; +break ;fs/cifs/connect.c +10
-0/* String Arguments */ @@ -2089,6 +2100,9 @@ static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol)if (!match_security (server, vol))return 0 ; +if (server->echo_interval != vol->echo_interval) +return 0 ; +return 1 ; }@@ -2208,6 +2222,13 @@ cifs_get_tcp_session(struct smb_vol *volume_info) tcp_ses->tcpStatus = CifsNew; ++tcp_ses->srv_count; +/* echo interval should be between 10 and 120 secs */ +if (volume_info->echo_interval >SMB_ECHO_INTERVAL_MIN || + volume_info->echo_interval <SMB_ECHO_INTERVAL_MAX ) + tcp_ses->echo_interval = volume_info->echo_interval *HZ ; +else + tcp_ses->echo_interval =SMB_ECHO_INTERVAL_DEFAULT *HZ ; +fs/cifs/connect.c +0
-0rc =ip_connect (tcp_ses);if (rc <0 ) { cifs_dbg(VFS, "Error connecting to socket. Abortingoperation.\n");
fs/cifs/connect.c +1
-2@@ -2237,7 +2258,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)cifs_fscache_get_client_cookie (tcp_ses);/* queue echo request delayed work */ -queue_delayed_work (cifsiod_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL); + queue_delayed_work(cifsiod_wq, &tcp_ses->echo, tcp_ses ->echo_interval); return tcp_ses;
A message that is not in the archive (sent off-list or not yet received): [email protected]
Looks correct. Only comment would be to keep one definition of echo_interval, preferably unsigned int (instead of unsigned long also).
Quoted 212 lines · Sachin Prabhu
Another approach as pointed to by Jeff Layton is to make it a module parameter which is then set for all shares mounted on the client.
Any comments on the patch are welcome.
Sachin Prabhu
Quoted 189 lines · Sachin Prabhu
Currently the echo interval is set to 60 seconds using a macro. This setting determines the interval at which echo requests are sent to the
server on an idling connection. This setting also affects the time required for a connection to an unresponsive server to timeout.Making this setting a tunable allows users to control the echo interval
times as well as control the time after which the connecting to an unresponsive server times out.Signed-off-by Sachin Prabhu <[email protected]>--- fs/cifs/cifsfs.c | 2 ++ fs/cifs/cifsglob.h | 8 ++++++-- fs/cifs/connect.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 35 insertions(+), 8 deletions(-)fs/cifs/cifsfs.c +2
-0@@ -507,6 +507,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) seq_printf(s, ",rsize=%u", cifs_sb->rsize);seq_printf (s,",wsize=%u" , cifs_sb->wsize); +seq_printf (s,",echo_interval=%lu" , + tcon->ses->server->echo_interval /HZ );/* convert actimeo and display it in seconds */ seq_printf (s,",actimeo=%lu" , cifs_sb->actimeo /HZ );fs/cifs/cifsglob.h +4
-2@@ -70,8 +70,10 @@#define SERVER_NAME_LENGTH 40#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) -/* SMB echo "timeout" -- FIXME: tunable? */ -#define SMB_ECHO_INTERVAL (60 * HZ) +/* echo interval in seconds */ +#define SMB_ECHO_INTERVAL_MIN 10 +#define SMB_ECHO_INTERVAL_MAX 120 +#define SMB_ECHO_INTERVAL_DEFAULT 60#include "cifspdu.h" @@ -507,6 +509,7 @@ struct smb_vol {struct sockaddr_storage dstaddr;/* destination address */ struct sockaddr_storage srcaddr;/* allow binding to a local IP */
struct nls_table *local_nls;fs/cifs/cifsglob.h +2
-0+unsigned int echo_interval;/* echo interval in secs */ };#define CIFS_MOUNT_MASK (CIFS_MOUNT_NO_PERM | CIFS_MOUNT_SET_UID | \@@ -628,6 +631,7 @@ struct TCP_Server_Info {unsigned int max_read;unsigned int max_write;#endif /* CONFIG_CIFS_SMB2 */ +unsigned long echo_interval; }; static inline unsigned intfs/cifs/connect.c +2
-0@@ -95,6 +95,7 @@ enum { Opt_cruid, Opt_gid, Opt_file_mode, Opt_dirmode, Opt_port, Opt_rsize, Opt_wsize, Opt_actimeo, + Opt_echo_interval,/* Mount options which take string value */ Opt_user, Opt_pass, Opt_ip,@@ -188,6 +189,7 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_rsize, "rsize=%s" }, { Opt_wsize, "wsize=%s" }, { Opt_actimeo, "actimeo=%s" }, + { Opt_echo_interval, "echo_interval=%s" }, { Opt_blank_user, "user=" },{ Opt_blank_user, "username=" },fs/cifs/connect.c +1
-0@@ -418,6 +420,7 @@ cifs_echo_request(struct work_struct *work)int rc;struct TCP_Server_Info *server =container_of (work, struct TCP_Server_Info, echo.work); +unsigned long echo_interval = server->echo_interval;/* * We cannot send an echo if it is disabled or until the
fs/cifs/connect.c +0
-0@@ -427,7 +430,7 @@ cifs_echo_request(struct work_struct *work)*/ if (!server->ops->need_neg || server->ops->need_neg(server)||
(server->ops->can_echo && !server->ops->can_echo(server)) ||
- time_before(jiffies,server->lstrp+SMB_ECHO_INTERVAL-
HZ))
+ time_before(jiffies,server->lstrp+echo_interval-
HZ))goto requeue_echo; rc = server->ops->echo ? server->ops->echo(server) :fs/cifs/connect.c +1
-2-ENOSYS ;@@ -436,7 +439,7 @@ cifs_echo_request(struct work_struct *work) server->hostname); requeue_echo: -queue_delayed_work (cifsiod_wq, &server->echo, SMB_ECHO_INTERVAL); +queue_delayed_work (cifsiod_wq, &server->echo, echo_interval); }static bool
fs/cifs/connect.c +0
-3@@ -487,9 +490,9 @@ server_unresponsive(struct TCP_Server_Info*server) * a response in >60s. */ if (server->tcpStatus == CifsGood && -time_after (jiffies, server->lstrp +2 * SMB_ECHO_INTERVAL)) { - cifs_dbg(VFS, "Server %s has not responded in %d seconds. Reconnecting...\n", - server->hostname, (2 * SMB_ECHO_INTERVAL) /HZ);
fs/cifs/connect.c +2
-1+ time_after(jiffies, server->lstrp + 2 * server ->echo_interval)) { + cifs_dbg(VFS, "Server %s has not responded in %luseconds. Reconnecting...\n",
fs/cifs/connect.c +9
-1+ server->hostname, (2 * server ->echo_interval) / HZ); cifs_reconnect(server);wake_up (&server->response_q);return true;@@ -1624,6 +1627,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, goto cifs_parse_mount_err; }break ; +case Opt_echo_interval: +if (get_option_ul (args, &option)) { + cifs_dbg(VFS, "%s: Invalid echo interval value\n", + __func__); + goto cifs_parse_mount_err; + } + vol->echo_interval = option; +break ;/* String Arguments */fs/cifs/connect.c +10
-0@@ -2089,6 +2100,9 @@ static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol)if (!match_security (server, vol))return 0 ; +if (server->echo_interval != vol->echo_interval) +return 0 ; +return 1 ; }@@ -2208,6 +2222,13 @@ cifs_get_tcp_session(struct smb_vol *volume_info) tcp_ses->tcpStatus = CifsNew; ++tcp_ses->srv_count; +/* echo interval should be between 10 and 120 secs */ +if (volume_info->echo_interval >SMB_ECHO_INTERVAL_MIN || + volume_info->echo_interval <SMB_ECHO_INTERVAL_MAX ) + tcp_ses->echo_interval = volume_info->echo_interval *HZ ; +else + tcp_ses->echo_interval =SMB_ECHO_INTERVAL_DEFAULT *HZ ; +rc = ip_connect(tcp_ses); if (rc < 0) { cifs_dbg(VFS, "Error connecting to socket. Abortingoperation.\n");
fs/cifs/connect.c cifs_get_tcp_session(struct smb_vol · line 2263
Quoted 10 lines
fs/cifs/connect.c +1
-2@@ -2237,7 +2258,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)cifs_fscache_get_client_cookie (tcp_ses);/* queue echo request delayed work */ -queue_delayed_work (cifsiod_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL); + queue_delayed_work(cifsiod_wq, &tcp_ses->echo, tcp_ses ->echo_interval); return tcp_ses;--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CADT32e+AtzJ5f5bOKKVz=uTonHvNMs=DJmNTnohy_Yi5HK=R7A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 3 lines · Shirish Pargaonkar
Looks correct. Only comment would be to keep one definition of
echo_interval,
preferably unsigned int (instead of unsigned long also).
Sirish,
The event_timeout defined in struct smb_vol contains the timeout value in seconds while the one defined in struct TCP_Server_Info multiplies the value from the smb_vol by HZ to get the time in ticks.
Sachin Prabhu
Quoted 227 lines
Quoted 224 lines · Sachin Prabhu
Another approach as pointed to by Jeff Layton is to make it a module
parameter which is then set for all shares mounted on the client.Any comments on the patch are welcome.
Sachin Prabhu
Quoted 207 lines · Sachin Prabhu
Currently the echo interval is set to 60 seconds using a macro. This
setting determines the interval at which echo requests are sent to
the
server on an idling connection. This setting also affects the time
required for a connection to an unresponsive server to timeout.Making this setting a tunable allows users to control the echo interval
times as well as control the time after which the connecting to an
unresponsive server times out.Signed-off-by Sachin Prabhu <[email protected]>---
fs/cifs/cifsfs.c | 2 ++
fs/cifs/cifsglob.h | 8 ++++++-- fs/cifs/connect.c | 33 +++++++++++++++++++++++++++------3 files changed, 35 insertions(+), 8 deletions(-)fs/cifs/cifsfs.c +2
-0@@ -507,6 +507,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) seq_printf(s, ",rsize=%u", cifs_sb->rsize); seq_printf(s, ",wsize=%u", cifs_sb->wsize); + seq_printf(s, ",echo_interval=%lu", + tcon->ses->server->echo_interval / HZ); /* convert actimeo and display it in seconds */ seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ);fs/cifs/cifsglob.h +4
-2@@ -70,8 +70,10 @@ #define SERVER_NAME_LENGTH 40 #define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) -/* SMB echo "timeout" -- FIXME: tunable? */ -#define SMB_ECHO_INTERVAL (60 * HZ) +/* echo interval in seconds */ +#define SMB_ECHO_INTERVAL_MIN 10 +#define SMB_ECHO_INTERVAL_MAX 120 +#define SMB_ECHO_INTERVAL_DEFAULT 60 #include "cifspdu.h"@@ -507,6 +509,7 @@ struct smb_vol {struct
sockaddr_storagedstaddr; /* destination address */ structsockaddr_storagesrcaddr; /* allow binding to a local
IP */
structnls_table*local_nls;
+ unsigned intecho_interval; /* echo interval in secs */ };#define
CIFS_MOUNT_MASK(CIFS_MOUNT_NO_PERM|CIFS_MOUNT_SET_UID| \fs/cifs/cifsglob.h +1
-0@@ -628,6 +631,7 @@ struct TCP_Server_Info { unsigned int max_read; unsigned int max_write; #endif /* CONFIG_CIFS_SMB2 */ + unsigned long echo_interval; };static inline unsigned int
fs/cifs/connect.c +2
-0@@ -95,6 +95,7 @@ enum { Opt_cruid, Opt_gid, Opt_file_mode, Opt_dirmode, Opt_port, Opt_rsize, Opt_wsize, Opt_actimeo, + Opt_echo_interval, /* Mount options which take string value */ Opt_user, Opt_pass, Opt_ip,@@ -188,6 +189,7 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_rsize, "rsize=%s" }, { Opt_wsize, "wsize=%s" }, { Opt_actimeo, "actimeo=%s" }, + { Opt_echo_interval, "echo_interval=%s" }, { Opt_blank_user, "user=" },{
Opt_blank_user, "username=" },fs/cifs/connect.c +1
-0@@ -418,6 +420,7 @@ cifs_echo_request(struct work_struct *work) int rc; struct TCP_Server_Info *server = container_of(work, struct TCP_Server_Info, echo.work); + unsigned long echo_interval = server->echo_interval; /** We cannot send an echo if it is disabled or until the
fs/cifs/connect.c +0
-0@@ -427,7 +430,7 @@ cifs_echo_request(struct work_struct *work)*/ if (!server->ops->need_neg || server->ops->need_neg(server)Quoted 1 line
Quoted 1 line
(server->ops->can_echo && !server->ops ->can_echo(server)) ||
- time_before(jiffies,server->lstrp+SMB_ECHO_INTERVAL-
HZ))
+ time_before(jiffies,server->lstrp+echo_interval- HZ))
gotorequeue_echo;rc =
server->ops->echo?server->ops->echo(server):fs/cifs/connect.c +0
-1-ENOSYS ;@@ -436,7 +439,7 @@ cifs_echo_request(struct work_struct *work) server->hostname);requeue_echo:
- queue_delayed_work(cifsiod_wq,&server->echo,SMB_ECHO_INTERVAL);
+ queue_delayed_work(cifsiod_wq,&server->echo,echo_interval);
}static bool
fs/cifs/connect.c +0
-0@@ -487,9 +490,9 @@ server_unresponsive(struct TCP_Server_Info*server) * a response in >60s. */ if (
server->tcpStatus== CifsGood &&
- time_after(jiffies,server->lstrp+ 2 *SMB_ECHO_INTERVAL)) {
- cifs_dbg(VFS, "Server %s has not responded in %d seconds. Reconnecting...\n",
- server->hostname, (2 *SMB_ECHO_INTERVAL) /
HZ);
+ time_after(jiffies,server->lstrp+ 2 * server ->echo_interval)) {
+ cifs_dbg(VFS, "Server %s has not responded in %lu seconds. Reconnecting...\n",
+ server->hostname, (2 * server ->echo_interval) / HZ);
cifs_reconnect(server);wake_up(&server->response_q);
return true;fs/cifs/connect.c +8
-0@@ -1624,6 +1627,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, goto cifs_parse_mount_err; } break; + case Opt_echo_interval: + if (get_option_ul(args, &option)) { + cifs_dbg(VFS, "%s: Invalid echo interval value\n", + __func__); + goto cifs_parse_mount_err; + } + vol->echo_interval = option; + break;/* String Arguments */
fs/cifs/connect.c +0
-0@@ -2089,6 +2100,9 @@ static int match_server(struct
TCP_Server_Info
*server, structsmb_vol*vol)
if (!match_security(server, vol))
return 0;+ if (
server->echo_interval!=vol->echo_interval) + return 0;
+
return 1;
}fs/cifs/connect.c +6
-0@@ -2208,6 +2222,13 @@ cifs_get_tcp_session(struct smb_vol *volume_info) tcp_ses->tcpStatus = CifsNew; ++tcp_ses->srv_count; + /* echo interval should be between 10 and 120 secs */ + if (volume_info->echo_interval > SMB_ECHO_INTERVAL_MIN || + volume_info->echo_interval < SMB_ECHO_INTERVAL_MAX) + tcp_ses->echo_interval = volume_info->echo_interval *HZ ; + else + tcp_ses->echo_interval = SMB_ECHO_INTERVAL_DEFAULT *HZ;
+
rc =ip_connect(tcp_ses);
if (rc < 0) {
cifs_dbg(VFS, "Error connecting to socket. Aborting operation.\n");fs/cifs/connect.c +1
-2@@ -2237,7 +2258,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) cifs_fscache_get_client_cookie(tcp_ses); /* queue echo request delayed work */ - queue_delayed_work(cifsiod_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL); + queue_delayed_work(cifsiod_wq, &tcp_ses->echo, tcp_ses ->echo_interval);Quoted 2 lines
return
tcp_ses;--
To unsubscribe from this list: send the line "unsubscribe linux- cifs" in
the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Shirish Pargaonkar
Acked-byQuoted 241 lines · Sachin Prabhu
Quoted 3 lines · Shirish Pargaonkar
Looks correct. Only comment would be to keep one definition of
echo_interval,
preferably unsigned int (instead of unsigned long also).Sirish,
The
event_timeoutdefined in structsmb_volcontains the timeout value in seconds while the one defined in structTCP_Server_Infomultiplies the value from thesmb_volby HZ to get the time in ticks.Sachin Prabhu
Quoted 227 lines
Quoted 224 lines · Sachin Prabhu
Another approach as pointed to by Jeff Layton is to make it a module
parameter which is then set for all shares mounted on the client.Any comments on the patch are welcome.
Sachin Prabhu
Quoted 199 lines · Sachin Prabhu
Currently the echo interval is set to 60 seconds using a macro. This
setting determines the interval at which echo requests are sent to
the
server on an idling connection. This setting also affects the time
required for a connection to an unresponsive server to timeout.Making this setting a tunable allows users to control the echo interval
times as well as control the time after which the connecting to an
unresponsive server times out.Signed-off-by Sachin Prabhu <[email protected]>--- fs/cifs/cifsfs.c | 2 ++ fs/cifs/cifsglob.h | 8 ++++++-- fs/cifs/connect.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 35 insertions(+), 8 deletions(-)fs/cifs/cifsfs.c +2
-0@@ -507,6 +507,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) seq_printf(s, ",rsize=%u", cifs_sb->rsize);seq_printf (s,",wsize=%u" , cifs_sb->wsize); +seq_printf (s,",echo_interval=%lu" , + tcon->ses->server->echo_interval /HZ );/* convert actimeo and display it in seconds */ seq_printf (s,",actimeo=%lu" , cifs_sb->actimeo /HZ );fs/cifs/cifsglob.h +4
-2@@ -70,8 +70,10 @@#define SERVER_NAME_LENGTH 40#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) -/* SMB echo "timeout" -- FIXME: tunable? */ -#define SMB_ECHO_INTERVAL (60 * HZ) +/* echo interval in seconds */ +#define SMB_ECHO_INTERVAL_MIN 10 +#define SMB_ECHO_INTERVAL_MAX 120 +#define SMB_ECHO_INTERVAL_DEFAULT 60#include "cifspdu.h" @@ -507,6 +509,7 @@ struct smb_vol {struct sockaddr_storage dstaddr;/* destination address */ struct sockaddr_storage srcaddr;/* allow binding to a local
IP */struct nls_table *local_nls;+ unsigned int
echo_interval; /* echo interval in secs */
};#define
CIFS_MOUNT_MASK(CIFS_MOUNT_NO_PERM|CIFS_MOUNT_SET_UID
| \fs/cifs/cifsglob.h +1
-0@@ -628,6 +631,7 @@ struct TCP_Server_Info {unsigned int max_read;unsigned int max_write;#endif /* CONFIG_CIFS_SMB2 */ +unsigned long echo_interval; }; static inline unsigned intfs/cifs/connect.c +2
-0@@ -95,6 +95,7 @@ enum { Opt_cruid, Opt_gid, Opt_file_mode, Opt_dirmode, Opt_port, Opt_rsize, Opt_wsize, Opt_actimeo, + Opt_echo_interval,/* Mount options which take string value */ Opt_user, Opt_pass, Opt_ip,@@ -188,6 +189,7 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_rsize, "rsize=%s" }, { Opt_wsize, "wsize=%s" }, { Opt_actimeo, "actimeo=%s" }, + { Opt_echo_interval, "echo_interval=%s" }, { Opt_blank_user, "user=" },{ Opt_blank_user, "username=" },fs/cifs/connect.c +1
-0@@ -418,6 +420,7 @@ cifs_echo_request(struct work_struct *work)int rc;struct TCP_Server_Info *server =container_of (work, struct TCP_Server_Info, echo.work); +unsigned long echo_interval = server->echo_interval;/* * We cannot send an echo if it is disabled or until the
fs/cifs/connect.c +0
-0@@ -427,7 +430,7 @@ cifs_echo_request(struct work_struct *work)*/ if (!server->ops->need_neg || server->ops->need_neg(server)Quoted 1 line
Quoted 1 line
(server->ops->can_echo && !server->ops->can_echo(server)) ||
fs/cifs/connect.c +0
-2- time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL -HZ))
+ time_before(jiffies,server->lstrp+echo_interval-
HZ))goto requeue_echo; rc = server->ops->echo ? server->ops->echo(server) :fs/cifs/connect.c +1
-2-ENOSYS ;@@ -436,7 +439,7 @@ cifs_echo_request(struct work_struct *work) server->hostname); requeue_echo: -queue_delayed_work (cifsiod_wq, &server->echo, SMB_ECHO_INTERVAL); +queue_delayed_work (cifsiod_wq, &server->echo, echo_interval); }static bool
fs/cifs/connect.c +0
-3@@ -487,9 +490,9 @@ server_unresponsive(struct TCP_Server_Info*server) * a response in >60s. */ if (server->tcpStatus == CifsGood && -time_after (jiffies, server->lstrp +2 * SMB_ECHO_INTERVAL)) { - cifs_dbg(VFS, "Server %s has not responded in %d seconds. Reconnecting...\n", - server->hostname, (2 * SMB_ECHO_INTERVAL)/
HZ);fs/cifs/connect.c +2
-1+ time_after(jiffies, server->lstrp + 2 * server ->echo_interval)) { + cifs_dbg(VFS, "Server %s has not responded in %luseconds. Reconnecting...\n",
fs/cifs/connect.c +9
-1+ server->hostname, (2 * server ->echo_interval) / HZ); cifs_reconnect(server);wake_up (&server->response_q);return true;@@ -1624,6 +1627,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, goto cifs_parse_mount_err; }break ; +case Opt_echo_interval: +if (get_option_ul (args, &option)) { + cifs_dbg(VFS, "%s: Invalid echo interval value\n", + __func__); + goto cifs_parse_mount_err; + } + vol->echo_interval = option; +break ;/* String Arguments */fs/cifs/connect.c +0
-0@@ -2089,6 +2100,9 @@ static int match_server(struct
TCP_Server_Info
*server, structsmb_vol*vol)
if (!match_security(server, vol))
return 0;fs/cifs/connect.c +9
-0+if (server->echo_interval != vol->echo_interval) +return 0 ; +return 1 ; }@@ -2208,6 +2222,13 @@ cifs_get_tcp_session(struct smb_vol *volume_info) tcp_ses->tcpStatus = CifsNew; ++tcp_ses->srv_count; +/* echo interval should be between 10 and 120 secs */ +if (volume_info->echo_interval >SMB_ECHO_INTERVAL_MIN || + volume_info->echo_interval <SMB_ECHO_INTERVAL_MAX ) + tcp_ses->echo_interval = volume_info->echo_interval *HZ ; +else + tcp_ses->echo_interval =SMB_ECHO_INTERVAL_DEFAULT *HZ;
+rc = ip_connect(tcp_ses); if (rc < 0) { cifs_dbg(VFS, "Error connecting to socket. Abortingoperation.\n");
fs/cifs/connect.c cifs_get_tcp_session(struct smb_vol
Quoted 10 lines
fs/cifs/connect.c +1
-2@@ -2237,7 +2258,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)cifs_fscache_get_client_cookie (tcp_ses);/* queue echo request delayed work */ -queue_delayed_work (cifsiod_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL); + queue_delayed_work(cifsiod_wq, &tcp_ses->echo, tcp_ses ->echo_interval); return tcp_ses;--
To unsubscribe from this list: send the line "unsubscribe linux- cifs" in
the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Why restrict the echo interval to such a narrow range? If tunable might as well allow a larger range, maybe 1 to 600 (ten minutes)? I am not certain of the range of possible future uses - maybe a pseudo-real type workload connected to a really fast server wants something really low (a few seconds?) and maybe very poor network connections want something longer? Not a strong objection, but seems like we could allow a broader range without confusing the user.
Many years ago, Windows and OS/2 had an oplock break time (which also controlled how long to wait for acks to come back from the server) - and it ranged from 34 to 127 seconds for acks and 35 to 640 for oplock
break timeouts. Don't see any reason to limit it less than that
(that was really old and networks vary a lot in performance now).
Thoughts?
Quoted 172 lines · Sachin Prabhu
Currently the echo interval is set to 60 seconds using a macro. This setting determines the interval at which echo requests are sent to the server on an idling connection. This setting also affects the time required for a connection to an unresponsive server to timeout.
Making this setting a tunable allows users to control the echo interval times as well as control the time after which the connecting to an unresponsive server times out.
Signed-off-by Sachin Prabhu <[email protected]>--- fs/cifs/cifsfs.c | 2 ++ fs/cifs/cifsglob.h | 8 ++++++-- fs/cifs/connect.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 35 insertions(+), 8 deletions(-)fs/cifs/cifsfs.c +2
-0@@ -507,6 +507,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)seq_printf (s,",rsize=%u" , cifs_sb->rsize);seq_printf (s,",wsize=%u" , cifs_sb->wsize); +seq_printf (s,",echo_interval=%lu" , + tcon->ses->server->echo_interval /HZ );/* convert actimeo and display it in seconds */ seq_printf (s,",actimeo=%lu" , cifs_sb->actimeo /HZ );fs/cifs/cifsglob.h +6
-2@@ -70,8 +70,10 @@#define SERVER_NAME_LENGTH 40#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) -/* SMB echo "timeout" -- FIXME: tunable? */ -#define SMB_ECHO_INTERVAL (60 * HZ) +/* echo interval in seconds */ +#define SMB_ECHO_INTERVAL_MIN 10 +#define SMB_ECHO_INTERVAL_MAX 120 +#define SMB_ECHO_INTERVAL_DEFAULT 60#include "cifspdu.h" @@ -507,6 +509,7 @@ struct smb_vol {struct sockaddr_storage dstaddr;/* destination address */ struct sockaddr_storage srcaddr;/* allow binding to a local IP */ struct nls_table *local_nls; +unsigned int echo_interval;/* echo interval in secs */ };#define CIFS_MOUNT_MASK (CIFS_MOUNT_NO_PERM | CIFS_MOUNT_SET_UID | \@@ -628,6 +631,7 @@ struct TCP_Server_Info {unsigned int max_read;unsigned int max_write;#endif /* CONFIG_CIFS_SMB2 */ +unsigned long echo_interval; }; static inline unsigned intfs/cifs/connect.c +27
-7@@ -95,6 +95,7 @@ enum { Opt_cruid, Opt_gid, Opt_file_mode, Opt_dirmode, Opt_port, Opt_rsize, Opt_wsize, Opt_actimeo, + Opt_echo_interval,/* Mount options which take string value */ Opt_user, Opt_pass, Opt_ip,@@ -188,6 +189,7 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_rsize, "rsize=%s" }, { Opt_wsize, "wsize=%s" }, { Opt_actimeo, "actimeo=%s" }, + { Opt_echo_interval, "echo_interval=%s" }, { Opt_blank_user, "user=" }, { Opt_blank_user, "username=" },@@ -418,6 +420,7 @@ cifs_echo_request(struct work_struct *work)int rc;struct TCP_Server_Info *server =container_of (work, struct TCP_Server_Info, echo.work); +unsigned long echo_interval = server->echo_interval;/* * We cannot send an echo if it is disabled or until the @@ -427,7 +430,7 @@ cifs_echo_request(struct work_struct *work)*/ if (!server->ops->need_neg || server->ops->need_neg (server) || (server->ops->can_echo && !server->ops->can_echo (server)) || -time_before (jiffies, server->lstrp +SMB_ECHO_INTERVAL -HZ )) +time_before (jiffies, server->lstrp + echo_interval -HZ )) goto requeue_echo; rc = server->ops->echo ? server->ops->echo (server) : -ENOSYS ;@@ -436,7 +439,7 @@ cifs_echo_request(struct work_struct *work) server->hostname); requeue_echo: -queue_delayed_work (cifsiod_wq, &server->echo,SMB_ECHO_INTERVAL ); +queue_delayed_work (cifsiod_wq, &server->echo, echo_interval); } static bool@@ -487,9 +490,9 @@ server_unresponsive(struct TCP_Server_Info *server)* a response in >60s. */ if (server->tcpStatus == CifsGood && -time_after (jiffies, server->lstrp +2 *SMB_ECHO_INTERVAL )) { -cifs_dbg (VFS ,"Server %s has not responded in %d seconds. Reconnecting...\n" , - server->hostname, (2 *SMB_ECHO_INTERVAL ) /HZ ); +time_after (jiffies, server->lstrp +2 * server->echo_interval)) { +cifs_dbg (VFS ,"Server %s has not responded in %lu seconds. Reconnecting...\n" , + server->hostname, (2 * server->echo_interval) /HZ );cifs_reconnect (server);wake_up (&server->response_q);return true;@@ -1624,6 +1627,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, goto cifs_parse_mount_err; }break ; +case Opt_echo_interval: +if (get_option_ul (args, &option)) { +cifs_dbg (VFS ,"%s: Invalid echo interval value\n" , + __func__); + goto cifs_parse_mount_err; + } + vol->echo_interval = option; +break ;/* String Arguments */ @@ -2089,6 +2100,9 @@ static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol)if (!match_security (server, vol))return 0 ; +if (server->echo_interval != vol->echo_interval) +return 0 ; +return 1 ; }@@ -2208,6 +2222,13 @@ cifs_get_tcp_session(struct smb_vol *volume_info) tcp_ses->tcpStatus = CifsNew; ++tcp_ses->srv_count; +/* echo interval should be between 10 and 120 secs */ +if (volume_info->echo_interval >SMB_ECHO_INTERVAL_MIN || + volume_info->echo_interval <SMB_ECHO_INTERVAL_MAX ) + tcp_ses->echo_interval = volume_info->echo_interval *HZ ; +else + tcp_ses->echo_interval =SMB_ECHO_INTERVAL_DEFAULT *HZ ; + rc =ip_connect (tcp_ses);if (rc <0 ) {cifs_dbg (VFS ,"Error connecting to socket. Aborting operation.\n" );@@ -2237,7 +2258,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)cifs_fscache_get_client_cookie (tcp_ses);/* queue echo request delayed work */ -queue_delayed_work (cifsiod_wq, &tcp_ses->echo,SMB_ECHO_INTERVAL ); +queue_delayed_work (cifsiod_wq, &tcp_ses->echo, tcp_ses->echo_interval);return tcp_ses; --2.4.3
Signature · 3 lines
Thanks, Steve
A message that is not in the archive (sent off-list or not yet received): CAH2r5mu1xKmd+cg33ti7UtBWpj9XCt5SL0B=7QnV4LDxw-79vw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 8 lines · Steve French
Why restrict the echo interval to such a narrow range? If tunable might as well allow a larger range, maybe 1 to 600 (ten minutes)? I am not certain of the range of possible future uses - maybe a pseudo-real type workload connected to a really fast server wants something really low (a few seconds?) and maybe very poor network connections want something longer? Not a strong objection, but seems like we could allow a broader range without confusing the user.
Quoted 8 lines
Many years ago, Windows and OS/2 had an oplock break time (which also controlled how long to wait for acks to come back from the server) - and it ranged from 34 to 127 seconds for acks and 35 to 640 for oplock
break timeouts. Don't see any reason to limit it less than that (that was really old and networks vary a lot in performance now).Thoughts?
the numbers I chose were arbitrary. I have no objections to changing the min and max values. Do you want me to send a new patch with those values?
Sachin Prabhu
Quoted 210 lines
Quoted 204 lines · Sachin Prabhu
Currently the echo interval is set to 60 seconds using a macro. This
setting determines the interval at which echo requests are sent to the
server on an idling connection. This setting also affects the time required for a connection to an unresponsive server to timeout.Making this setting a tunable allows users to control the echo interval
times as well as control the time after which the connecting to an unresponsive server times out.Signed-off-by Sachin Prabhu <[email protected]>---
fs/cifs/cifsfs.c | 2 ++
fs/cifs/cifsglob.h | 8 ++++++-- fs/cifs/connect.c | 33 +++++++++++++++++++++++++++------3 files changed, 35 insertions(+), 8 deletions(-)fs/cifs/cifsfs.c +2
-0@@ -507,6 +507,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) seq_printf(s, ",rsize=%u", cifs_sb->rsize); seq_printf(s, ",wsize=%u", cifs_sb->wsize); + seq_printf(s, ",echo_interval=%lu", + tcon->ses->server->echo_interval / HZ); /* convert actimeo and display it in seconds */ seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ);fs/cifs/cifsglob.h +4
-2@@ -70,8 +70,10 @@ #define SERVER_NAME_LENGTH 40 #define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) -/* SMB echo "timeout" -- FIXME: tunable? */ -#define SMB_ECHO_INTERVAL (60 * HZ) +/* echo interval in seconds */ +#define SMB_ECHO_INTERVAL_MIN 10 +#define SMB_ECHO_INTERVAL_MAX 120 +#define SMB_ECHO_INTERVAL_DEFAULT 60 #include "cifspdu.h"@@ -507,6 +509,7 @@ struct smb_vol {struct
sockaddr_storagedstaddr; /* destination address */ structsockaddr_storagesrcaddr; /* allow binding to a local IP */
structnls_table*local_nls;
+ unsigned intecho_interval; /* echo interval in secs */ };#define
CIFS_MOUNT_MASK(CIFS_MOUNT_NO_PERM|CIFS_MOUNT_SET_UID| \fs/cifs/cifsglob.h +1
-0@@ -628,6 +631,7 @@ struct TCP_Server_Info { unsigned int max_read; unsigned int max_write; #endif /* CONFIG_CIFS_SMB2 */ + unsigned long echo_interval; };static inline unsigned int
fs/cifs/connect.c +2
-0@@ -95,6 +95,7 @@ enum { Opt_cruid, Opt_gid, Opt_file_mode, Opt_dirmode, Opt_port, Opt_rsize, Opt_wsize, Opt_actimeo, + Opt_echo_interval, /* Mount options which take string value */ Opt_user, Opt_pass, Opt_ip,@@ -188,6 +189,7 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_rsize, "rsize=%s" }, { Opt_wsize, "wsize=%s" }, { Opt_actimeo, "actimeo=%s" }, + { Opt_echo_interval, "echo_interval=%s" }, { Opt_blank_user, "user=" },{
Opt_blank_user, "username=" },fs/cifs/connect.c +1
-0@@ -418,6 +420,7 @@ cifs_echo_request(struct work_struct *work) int rc; struct TCP_Server_Info *server = container_of(work, struct TCP_Server_Info, echo.work); + unsigned long echo_interval = server->echo_interval; /** We cannot send an echo if it is disabled or until the
fs/cifs/connect.c +0
-0@@ -427,7 +430,7 @@ cifs_echo_request(struct work_struct *work)*/ if (!server->ops->need_neg || server->ops->need_neg(server)||
(server->ops->can_echo && !server->ops-Quoted 1 line
can_echo(server)) ||- time_before(jiffies,
server->lstrp+SMB_ECHO_INTERVAL
- HZ))
+ time_before(jiffies,server->lstrp+echo_interval- HZ))
gotorequeue_echo;rc =
server->ops->echo?server->ops->echo(server):fs/cifs/connect.c +0
-1-ENOSYS ;@@ -436,7 +439,7 @@ cifs_echo_request(struct work_struct *work) server->hostname);requeue_echo:
- queue_delayed_work(cifsiod_wq,&server->echo,SMB_ECHO_INTERVAL);
+ queue_delayed_work(cifsiod_wq,&server->echo,echo_interval);
}static bool
fs/cifs/connect.c +0
-0@@ -487,9 +490,9 @@ server_unresponsive(struct TCP_Server_Info*server) * a response in >60s. */ if (
server->tcpStatus== CifsGood &&
- time_after(jiffies,server->lstrp+ 2 *SMB_ECHO_INTERVAL)) {
- cifs_dbg(VFS, "Server %s has not responded in %d seconds. Reconnecting...\n",
- server->hostname, (2 *SMB_ECHO_INTERVAL) / HZ);
+ time_after(jiffies,server->lstrp+ 2 * server-Quoted 1 line
echo_interval)) {+ cifs_dbg(VFS, "Server %s has not responded in %lu seconds. Reconnecting...\n",
+ server->hostname, (2 * server-Quoted 1 line
echo_interval) / HZ);cifs_reconnect(server);
wake_up(&server->response_q);
return true;fs/cifs/connect.c +8
-0@@ -1624,6 +1627,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, goto cifs_parse_mount_err; } break; + case Opt_echo_interval: + if (get_option_ul(args, &option)) { + cifs_dbg(VFS, "%s: Invalid echo interval value\n", + __func__); + goto cifs_parse_mount_err; + } + vol->echo_interval = option; + break;/* String Arguments */
fs/cifs/connect.c +10
-0@@ -2089,6 +2100,9 @@ static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol) if (!match_security(server, vol)) return 0; + if (server->echo_interval != vol->echo_interval) + return 0; + return 1; }@@ -2208,6 +2222,13 @@ cifs_get_tcp_session(struct smb_vol *volume_info) tcp_ses->tcpStatus = CifsNew; ++tcp_ses->srv_count; + /* echo interval should be between 10 and 120 secs */ + if (volume_info->echo_interval > SMB_ECHO_INTERVAL_MIN || + volume_info->echo_interval < SMB_ECHO_INTERVAL_MAX) + tcp_ses->echo_interval = volume_info->echo_interval *HZ ; + else + tcp_ses->echo_interval = SMB_ECHO_INTERVAL_DEFAULT *HZ ; +rc =
ip_connect(tcp_ses);
if (rc < 0) {
cifs_dbg(VFS, "Error connecting to socket. Aborting operation.\n");fs/cifs/connect.c +1
-1@@ -2237,7 +2258,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) cifs_fscache_get_client_cookie(tcp_ses); /* queue echo request delayed work */ - queue_delayed_work(cifsiod_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL); + queue_delayed_work(cifsiod_wq, &tcp_ses->echo, tcp_ses- >echo_interval);return
tcp_ses;--
2.4.3
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 16 lines · Sachin Prabhu
Quoted 15 lines · Steve French
Why restrict the echo interval to such a narrow range? If tunable might as well allow a larger range, maybe 1 to 600 (ten minutes)? I am not certain of the range of possible future uses - maybe a pseudo-real type workload connected to a really fast server wants something really low (a few seconds?) and maybe very poor network connections want something longer? Not a strong objection, but seems like we could allow a broader range without confusing the user.
Many years ago, Windows and OS/2 had an oplock break time (which also controlled how long to wait for acks to come back from the server) - and it ranged from 34 to 127 seconds for acks and 35 to 640 for oplock
break timeouts. Don't see any reason to limit it less than that
(that was really old and networks vary a lot in performance now).
Quoted 7 lines
Quoted 1 line
Thoughts?
the numbers I chose were arbitrary. I have no objections to changing the min and max values. Do you want me to send a new patch with those values?
Sachin Prabhu
Yes - then I plan to merge unless any objections.
Quoted 211 lines
Quoted 210 lines
Quoted 204 lines · Sachin Prabhu
Currently the echo interval is set to 60 seconds using a macro. This
setting determines the interval at which echo requests are sent to the
server on an idling connection. This setting also affects the time required for a connection to an unresponsive server to timeout.Making this setting a tunable allows users to control the echo interval
times as well as control the time after which the connecting to an unresponsive server times out.Signed-off-by Sachin Prabhu <[email protected]>--- fs/cifs/cifsfs.c | 2 ++ fs/cifs/cifsglob.h | 8 ++++++-- fs/cifs/connect.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 35 insertions(+), 8 deletions(-)fs/cifs/cifsfs.c +2
-0@@ -507,6 +507,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) seq_printf(s, ",rsize=%u", cifs_sb->rsize);seq_printf (s,",wsize=%u" , cifs_sb->wsize); +seq_printf (s,",echo_interval=%lu" , + tcon->ses->server->echo_interval /HZ );/* convert actimeo and display it in seconds */ seq_printf (s,",actimeo=%lu" , cifs_sb->actimeo /HZ );fs/cifs/cifsglob.h +4
-2@@ -70,8 +70,10 @@#define SERVER_NAME_LENGTH 40#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) -/* SMB echo "timeout" -- FIXME: tunable? */ -#define SMB_ECHO_INTERVAL (60 * HZ) +/* echo interval in seconds */ +#define SMB_ECHO_INTERVAL_MIN 10 +#define SMB_ECHO_INTERVAL_MAX 120 +#define SMB_ECHO_INTERVAL_DEFAULT 60#include "cifspdu.h" @@ -507,6 +509,7 @@ struct smb_vol {struct sockaddr_storage dstaddr;/* destination address */ struct sockaddr_storage srcaddr;/* allow binding to a local IP */
struct nls_table *local_nls;+ unsigned int
echo_interval; /* echo interval in secs */
};#define
CIFS_MOUNT_MASK(CIFS_MOUNT_NO_PERM|CIFS_MOUNT_SET_UID|
\fs/cifs/cifsglob.h +1
-0@@ -628,6 +631,7 @@ struct TCP_Server_Info {unsigned int max_read;unsigned int max_write;#endif /* CONFIG_CIFS_SMB2 */ +unsigned long echo_interval; }; static inline unsigned intfs/cifs/connect.c +2
-0@@ -95,6 +95,7 @@ enum { Opt_cruid, Opt_gid, Opt_file_mode, Opt_dirmode, Opt_port, Opt_rsize, Opt_wsize, Opt_actimeo, + Opt_echo_interval,/* Mount options which take string value */ Opt_user, Opt_pass, Opt_ip,@@ -188,6 +189,7 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_rsize, "rsize=%s" }, { Opt_wsize, "wsize=%s" }, { Opt_actimeo, "actimeo=%s" }, + { Opt_echo_interval, "echo_interval=%s" }, { Opt_blank_user, "user=" },{ Opt_blank_user, "username=" },fs/cifs/connect.c +1
-0@@ -418,6 +420,7 @@ cifs_echo_request(struct work_struct *work)int rc;struct TCP_Server_Info *server =container_of (work, struct TCP_Server_Info, echo.work); +unsigned long echo_interval = server->echo_interval;/* * We cannot send an echo if it is disabled or until the
fs/cifs/connect.c +0
-0@@ -427,7 +430,7 @@ cifs_echo_request(struct work_struct *work)*/ if (!server->ops->need_neg || server->ops->need_neg(server)||
(server->ops->can_echo && !server->ops-Quoted 1 line
can_echo(server)) ||fs/cifs/connect.c +1
-2-time_before (jiffies, server->lstrp +SMB_ECHO_INTERVAL - HZ)) + time_before(jiffies, server->lstrp + echo_interval -HZ))
goto requeue_echo; rc = server->ops->echo ? server->ops->echo(server) :fs/cifs/connect.c +1
-2-ENOSYS ;@@ -436,7 +439,7 @@ cifs_echo_request(struct work_struct *work) server->hostname); requeue_echo: -queue_delayed_work (cifsiod_wq, &server->echo, SMB_ECHO_INTERVAL); +queue_delayed_work (cifsiod_wq, &server->echo, echo_interval); }static bool
fs/cifs/connect.c +0
-3@@ -487,9 +490,9 @@ server_unresponsive(struct TCP_Server_Info*server) * a response in >60s. */ if (server->tcpStatus == CifsGood && -time_after (jiffies, server->lstrp +2 * SMB_ECHO_INTERVAL)) { - cifs_dbg(VFS, "Server %s has not responded in %d seconds. Reconnecting...\n", - server->hostname, (2 * SMB_ECHO_INTERVAL)/ HZ);
+ time_after(jiffies,server->lstrp+ 2 * server-Quoted 1 line
echo_interval)) {+ cifs_dbg(VFS, "Server %s has not responded in %lu
seconds. Reconnecting...\n",
+server->hostname, (2 * server-Quoted 1 line
echo_interval) / HZ);cifs_reconnect(server); wake_up(&server->response_q); return true;fs/cifs/connect.c +8
-0@@ -1624,6 +1627,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, goto cifs_parse_mount_err; }break ; +case Opt_echo_interval: +if (get_option_ul (args, &option)) { + cifs_dbg(VFS, "%s: Invalid echo interval value\n", + __func__); + goto cifs_parse_mount_err; + } + vol->echo_interval = option; +break ;/* String Arguments */fs/cifs/connect.c +10
-0@@ -2089,6 +2100,9 @@ static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol)if (!match_security (server, vol))return 0 ; +if (server->echo_interval != vol->echo_interval) +return 0 ; +return 1 ; }@@ -2208,6 +2222,13 @@ cifs_get_tcp_session(struct smb_vol *volume_info) tcp_ses->tcpStatus = CifsNew; ++tcp_ses->srv_count; +/* echo interval should be between 10 and 120 secs */ +if (volume_info->echo_interval >SMB_ECHO_INTERVAL_MIN || + volume_info->echo_interval <SMB_ECHO_INTERVAL_MAX ) + tcp_ses->echo_interval = volume_info->echo_interval *HZ ; +else + tcp_ses->echo_interval =SMB_ECHO_INTERVAL_DEFAULT *HZ ; +rc = ip_connect(tcp_ses); if (rc < 0) { cifs_dbg(VFS, "Error connecting to socket. Abortingoperation.\n");
fs/cifs/connect.c +1
-1@@ -2237,7 +2258,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)cifs_fscache_get_client_cookie (tcp_ses);/* queue echo request delayed work */ -queue_delayed_work (cifsiod_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL); +queue_delayed_work (cifsiod_wq, &tcp_ses->echo, tcp_ses- >echo_interval);return tcp_ses;--
2.4.3
Signature · 3 lines
Thanks, Steve
Quoted 8 lines · Steve French
Why restrict the echo interval to such a narrow range? If tunable might as well allow a larger range, maybe 1 to 600 (ten minutes)? I am not certain of the range of possible future uses - maybe a pseudo-real type workload connected to a really fast server wants something really low (a few seconds?) and maybe very poor network connections want something longer? Not a strong objection, but seems like we could allow a broader range without confusing the user.
Quoted 7 lines
Many years ago, Windows and OS/2 had an oplock break time (which also controlled how long to wait for acks to come back from the server) - and it ranged from 34 to 127 seconds for acks and 35 to 640 for oplock
break timeouts. Don't see any reason to limit it less than that
(that was really old and networks vary a lot in performance now).Thoughts?
For context, were those timeouts for when broadcasts and signaling were over three protocols (IPX, IP, and NetBEUI? I can't recall, but Chris H. was telling tales of yore last month at a dinner and IIRC the propagation for SMB was over three protocols because usually at least one would eventually reach remote hosts under most conditions)? I have no issue with long timeouts, but what was the historical context of the 10 minute oplock breaks? Forgive me if I'm recalling incorrectly, but I thought that the extended timeouts were for much-less-than-optimal conditions over multiple protocols attached to hubs.