Skip to content

Commit

Permalink
cifs: unbreak TCP session reuse
Browse files Browse the repository at this point in the history
adfeb3e ("cifs: Make echo interval tunable") added a comparison of
vol->echo_interval to server->echo_interval as a criterium to
match_server(), but:

 (1) A default value is set for server->echo_interval but not for
 vol->echo_interval, meaning these can never match if the echo_interval
 option is not specified.

 (2) vol->echo_interval is in seconds but server->echo_interval is in
 jiffies, meaning these can never match even if the echo_interval option
 is specified.

This broke TCP session reuse since match_server() can never return 1.
Fix it.

Fixes: adfeb3e ("cifs: Make echo interval tunable")
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Acked-by: Sachin Prabhu <sprabhu@redhat.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Steve French <smfrench@gmail.com>
  • Loading branch information
vwax authored and smfrench committed Jul 19, 2016
1 parent 8d9535b commit b782fcc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
vol->ops = &smb1_operations;
vol->vals = &smb1_values;

vol->echo_interval = SMB_ECHO_INTERVAL_DEFAULT;

if (!mountdata)
goto cifs_parse_mount_err;

Expand Down Expand Up @@ -2049,7 +2051,7 @@ 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)
if (server->echo_interval != vol->echo_interval * HZ)
return 0;

return 1;
Expand Down

0 comments on commit b782fcc

Please sign in to comment.