Skip to contentSkip to conversation

cifs: unbreak TCP session reuse

PATCH In review Rabin Vincent 4 participants 4 messages Jul 19, 2016 – Jul 20, 2016 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: unbreak TCP session reuse

From: Rabin Vincent <[email protected]>

adfeb3e0 ("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 adfeb3e0 ("cifs: Make echo interval tunable")
---
 fs/cifs/connect.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/cifs/connect.c +3 -1
index 7d2b15c..eb24653 100644
@@ -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;
 
@@ -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;
Signature · 1 line
2.1.4
Acked-by
#2 lore raw
In reply to a message not in the archive
Quoted 16 lines · Rabin Vincent

From: Rabin Vincent <[email protected]>

adfeb3e0 ("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.

Quoted 5 lines

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

Fixes adfeb3e0 ("cifs: Make echo interval tunable")

Nice catch

Quoted 28 lines

---
 fs/cifs/connect.c | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
fs/cifs/connect.c +0 -0
index 7d2b15c..eb24653 100644
@@ -1228,6 +1228,8 @@ cifs_parse_mount_options(const char *mountdata,
 const char *devname,
  	vol->ops = &smb1_operations;
  	vol->vals = &smb1_values;

fs/cifs/connect.c +2 -0
+	vol->echo_interval = SMB_ECHO_INTERVAL_DEFAULT;
+

  if (!mountdata)
  goto cifs_parse_mount_err;

fs/cifs/connect.c +0 -0
@@ -2049,7 +2051,7 @@ static int match_server(struct TCP_Server_Info
 *server, struct smb_vol *vol)
  	if (!match_security(server, vol))
  		return 0;

fs/cifs/connect.c +1 -1
-	if (server->echo_interval != vol->echo_interval)
+	if (server->echo_interval != vol->echo_interval * HZ)

  return 0;

  return 1;

#6 lore raw
In reply to a message not in the archive

2016-07-19 10:25 GMT+03:00 Rabin Vincent <[email protected]>:

Quoted 48 lines

From: Rabin Vincent <[email protected]>

adfeb3e0 ("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 adfeb3e0 ("cifs: Make echo interval tunable")
---
 fs/cifs/connect.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/cifs/connect.c +3 -2
index 7d2b15c..eb24653 100644
@@ -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;
 
@@ -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;
--

2.1.4

Quoted 4 lines

--
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

Looks good. I applied it and it works as expected.

Signature · 2 lines
Best regards,
Pavel Shilovsky
Applied
#5 lore raw

PATCH 1/1 cifs: unbreak TCP session reuse

In reply to a message not in the archive

merged into cifs-2.6.git and added cc: stable

Quoted 61 lines · Sachin Prabhu
Quoted 16 lines · Rabin Vincent

From: Rabin Vincent <[email protected]>

adfeb3e0 ("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.

Quoted 5 lines

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

Fixes adfeb3e0 ("cifs: Make echo interval tunable")

Nice catch

Quoted 27 lines
---
 fs/cifs/connect.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/cifs/connect.c +3 -1
index 7d2b15c..eb24653 100644
@@ -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;
@@ -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;
 
Quoted 1 line
      return 1;

--
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

Signature · 10 lines
Thanks,

Steve



-- 
Thanks,

Steve