Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels.
@ 2025-02-14 12:43 aman1cifs
  2025-02-14 12:43 ` [PATCH 2/2] CIFS: adds min_offload and other params to cifs_debug aman1cifs
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: aman1cifs @ 2025-02-14 12:43 UTC (permalink / raw)
  To: linux-cifs, sfrench, pc, sprasad, tom, ronniesahlberg, bharathsm; +Cc: Aman

From: Aman <aman1@microsoft.com>

In a multichannel setup, it was observed that a few fields were not being
copied over to the secondary channels, which impacted performance in cases
where these options were relevant but not properly synchronized. To address
this, this patch introduces copying the following parameters from the
primary channel to the secondary channels:

- min_offload
- compression.requested
- dfs_conn
- ignore_signature
- leaf_fullpath
- noblockcnt
- retrans
- sign

By copying these parameters, we ensure consistency across channels and
prevent performance degradation due to missing or outdated settings.

Signed-off-by: Aman <aman1@microsoft.com>
---
 fs/smb/client/connect.c |  1 +
 fs/smb/client/sess.c    | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index eaa6be445..eb82458eb 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -1721,6 +1721,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
 	/* Grab netns reference for this server. */
 	cifs_set_net_ns(tcp_ses, get_net(current->nsproxy->net_ns));
 
+	tcp_ses->sign = ctx->sign;
 	tcp_ses->conn_id = atomic_inc_return(&tcpSesNextId);
 	tcp_ses->noblockcnt = ctx->rootfs;
 	tcp_ses->noblocksnd = ctx->noblocksnd || ctx->rootfs;
diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
index 91d4d409c..fdbd32a13 100644
--- a/fs/smb/client/sess.c
+++ b/fs/smb/client/sess.c
@@ -522,6 +522,16 @@ cifs_ses_add_channel(struct cifs_ses *ses,
 	ctx->sockopt_tcp_nodelay = ses->server->tcp_nodelay;
 	ctx->echo_interval = ses->server->echo_interval / HZ;
 	ctx->max_credits = ses->server->max_credits;
+	ctx->min_offload = ses->server->min_offload;
+	ctx->compress = ses->server->compression.requested;
+	ctx->dfs_conn = ses->server->dfs_conn;
+	ctx->ignore_signature = ses->server->ignore_signature;
+
+	if (ses->server->leaf_fullpath)
+		ctx->leaf_fullpath = kstrdup(ses->server->leaf_fullpath, GFP_KERNEL);
+
+	ctx->rootfs = ses->server->noblockcnt;
+	ctx->retrans = ses->server->retrans;
 
 	/*
 	 * This will be used for encoding/decoding user/domain/pw
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] CIFS: adds min_offload and other params to cifs_debug
  2025-02-14 12:43 [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels aman1cifs
@ 2025-02-14 12:43 ` aman1cifs
  2025-02-14 17:55   ` Steve French
  2025-02-27 16:33 ` [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels Paulo Alcantara
  2025-03-06 17:46 ` aman1cifs
  2 siblings, 1 reply; 9+ messages in thread
From: aman1cifs @ 2025-02-14 12:43 UTC (permalink / raw)
  To: linux-cifs, sfrench, pc, sprasad, tom, ronniesahlberg, bharathsm; +Cc: Aman

From: Aman <aman1@microsoft.com>

This change adds more parameters for debugging into the status of all
channels. It adds the following TCP server parameters to cifs_debug.c

        - min_offload
        - compression.requested
        - dfs_conn
        - ignore_signature
        - leaf_fullpath
        - retrans
        - noblockcnt
        - noblocksnd
        - sign
        - max_credits

This is a logical follow up to a previous patch titled:
"[PATCH] CIFS: Propagate min offload along with other parameters from
primary to secondary channels",
however this has been tested and applies independently.

Signed-off-by: Aman <aman1@microsoft.com>
---
 fs/smb/client/cifs_debug.c | 47 +++++++++++++++++++++++++++++++++++---
 1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/fs/smb/client/cifs_debug.c b/fs/smb/client/cifs_debug.c
index e03c890de..64a565c46 100644
--- a/fs/smb/client/cifs_debug.c
+++ b/fs/smb/client/cifs_debug.c
@@ -147,8 +147,16 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
 		   "\n\t\tNumber of credits: %d,%d,%d Dialect 0x%x"
 		   "\n\t\tTCP status: %d Instance: %d"
 		   "\n\t\tLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d"
-		   "\n\t\tIn Send: %d In MaxReq Wait: %d",
-		   i+1, server->conn_id,
+		   "\n\t\tIn Send: %d In MaxReq Wait: %d"
+		   "\n\t\tCompression Requested: %s"
+		   "\n\t\tdfs_conn: %s"
+		   "\n\t\tIgnore Signature: %s"
+		   "\n\t\tretrans: %d"
+		   "\n\t\tUse non-blocking connect: %s"
+		   "\n\t\tUse non-blocking sendmsg: %s"
+		   "\n\t\tSigning Enabled: %s"
+		   "\n\t\tMin Offload: %d Max Credits: %d",
+		   i, server->conn_id,
 		   server->credits,
 		   server->echo_credits,
 		   server->oplock_credits,
@@ -159,7 +167,22 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
 		   server->sec_mode,
 		   in_flight(server),
 		   atomic_read(&server->in_send),
-		   atomic_read(&server->num_waiters));
+		   atomic_read(&server->num_waiters),
+		   str_yes_no(server->compression.requested),
+		   str_yes_no(server->dfs_conn),
+		   str_yes_no(server->ignore_signature),
+		   server->retrans,
+		   str_yes_no(server->noblockcnt),
+		   str_yes_no(server->noblocksnd),
+		   str_yes_no(server->sign),
+		   server->min_offload,
+		   server->max_credits);
+
+	if (server->leaf_fullpath) {
+		seq_printf(m, "\n\t\tDFS leaf full path: %s",
+			   server->leaf_fullpath);
+	}
+
 #ifdef CONFIG_NET_NS
 	if (server->net)
 		seq_printf(m, " Net namespace: %u ", server->net->ns.inum);
@@ -487,6 +510,24 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 		else
 			seq_puts(m, "disabled (not supported by this server)");
 
+		seq_printf(m, "\nCompression Requested: %s"
+		   "\ndfs_conn: %s"
+		   "\nIgnore Signature: %s"
+		   "\nretrans: %d"
+		   "\nUse non-blocking connect: %s"
+		   "\nUse non-blocking sendmsg: %s"
+		   "\nSigning Enabled: %s"
+		   "\nMin Offload: %d Max Credits: %d",
+		   str_yes_no(server->compression.requested),
+		   str_yes_no(server->dfs_conn),
+		   str_yes_no(server->ignore_signature),
+		   server->retrans,
+		   str_yes_no(server->noblockcnt),
+		   str_yes_no(server->noblocksnd),
+		   str_yes_no(server->sign),
+		   server->min_offload,
+		   server->max_credits);
+
 		seq_printf(m, "\n\n\tSessions: ");
 		i = 0;
 		list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] CIFS: adds min_offload and other params to cifs_debug
  2025-02-14 12:43 ` [PATCH 2/2] CIFS: adds min_offload and other params to cifs_debug aman1cifs
@ 2025-02-14 17:55   ` Steve French
  0 siblings, 0 replies; 9+ messages in thread
From: Steve French @ 2025-02-14 17:55 UTC (permalink / raw)
  To: aman1cifs
  Cc: linux-cifs, sfrench, pc, sprasad, tom, ronniesahlberg, bharathsm,
	Aman

If these parameters are the same for all channels with your patch,
would it make sense to print them only once (rather than once per
channel) to save debug output?

On Fri, Feb 14, 2025 at 6:43 AM <aman1cifs@gmail.com> wrote:
>
> From: Aman <aman1@microsoft.com>
>
> This change adds more parameters for debugging into the status of all
> channels. It adds the following TCP server parameters to cifs_debug.c
>
>         - min_offload
>         - compression.requested
>         - dfs_conn
>         - ignore_signature
>         - leaf_fullpath
>         - retrans
>         - noblockcnt
>         - noblocksnd
>         - sign
>         - max_credits
>
> This is a logical follow up to a previous patch titled:
> "[PATCH] CIFS: Propagate min offload along with other parameters from
> primary to secondary channels",
> however this has been tested and applies independently.
>
> Signed-off-by: Aman <aman1@microsoft.com>
> ---
>  fs/smb/client/cifs_debug.c | 47 +++++++++++++++++++++++++++++++++++---
>  1 file changed, 44 insertions(+), 3 deletions(-)
>
> diff --git a/fs/smb/client/cifs_debug.c b/fs/smb/client/cifs_debug.c
> index e03c890de..64a565c46 100644
> --- a/fs/smb/client/cifs_debug.c
> +++ b/fs/smb/client/cifs_debug.c
> @@ -147,8 +147,16 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
>                    "\n\t\tNumber of credits: %d,%d,%d Dialect 0x%x"
>                    "\n\t\tTCP status: %d Instance: %d"
>                    "\n\t\tLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d"
> -                  "\n\t\tIn Send: %d In MaxReq Wait: %d",
> -                  i+1, server->conn_id,
> +                  "\n\t\tIn Send: %d In MaxReq Wait: %d"
> +                  "\n\t\tCompression Requested: %s"
> +                  "\n\t\tdfs_conn: %s"
> +                  "\n\t\tIgnore Signature: %s"
> +                  "\n\t\tretrans: %d"
> +                  "\n\t\tUse non-blocking connect: %s"
> +                  "\n\t\tUse non-blocking sendmsg: %s"
> +                  "\n\t\tSigning Enabled: %s"
> +                  "\n\t\tMin Offload: %d Max Credits: %d",
> +                  i, server->conn_id,
>                    server->credits,
>                    server->echo_credits,
>                    server->oplock_credits,
> @@ -159,7 +167,22 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
>                    server->sec_mode,
>                    in_flight(server),
>                    atomic_read(&server->in_send),
> -                  atomic_read(&server->num_waiters));
> +                  atomic_read(&server->num_waiters),
> +                  str_yes_no(server->compression.requested),
> +                  str_yes_no(server->dfs_conn),
> +                  str_yes_no(server->ignore_signature),
> +                  server->retrans,
> +                  str_yes_no(server->noblockcnt),
> +                  str_yes_no(server->noblocksnd),
> +                  str_yes_no(server->sign),
> +                  server->min_offload,
> +                  server->max_credits);
> +
> +       if (server->leaf_fullpath) {
> +               seq_printf(m, "\n\t\tDFS leaf full path: %s",
> +                          server->leaf_fullpath);
> +       }
> +
>  #ifdef CONFIG_NET_NS
>         if (server->net)
>                 seq_printf(m, " Net namespace: %u ", server->net->ns.inum);
> @@ -487,6 +510,24 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
>                 else
>                         seq_puts(m, "disabled (not supported by this server)");
>
> +               seq_printf(m, "\nCompression Requested: %s"
> +                  "\ndfs_conn: %s"
> +                  "\nIgnore Signature: %s"
> +                  "\nretrans: %d"
> +                  "\nUse non-blocking connect: %s"
> +                  "\nUse non-blocking sendmsg: %s"
> +                  "\nSigning Enabled: %s"
> +                  "\nMin Offload: %d Max Credits: %d",
> +                  str_yes_no(server->compression.requested),
> +                  str_yes_no(server->dfs_conn),
> +                  str_yes_no(server->ignore_signature),
> +                  server->retrans,
> +                  str_yes_no(server->noblockcnt),
> +                  str_yes_no(server->noblocksnd),
> +                  str_yes_no(server->sign),
> +                  server->min_offload,
> +                  server->max_credits);
> +
>                 seq_printf(m, "\n\n\tSessions: ");
>                 i = 0;
>                 list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
> --
> 2.43.0
>
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels.
  2025-02-14 12:43 [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels aman1cifs
  2025-02-14 12:43 ` [PATCH 2/2] CIFS: adds min_offload and other params to cifs_debug aman1cifs
@ 2025-02-27 16:33 ` Paulo Alcantara
  2025-03-06 17:46 ` aman1cifs
  2 siblings, 0 replies; 9+ messages in thread
From: Paulo Alcantara @ 2025-02-27 16:33 UTC (permalink / raw)
  To: aman1cifs, linux-cifs, sfrench, sprasad, tom, ronniesahlberg,
	bharathsm
  Cc: Aman

aman1cifs@gmail.com writes:

> From: Aman <aman1@microsoft.com>
>
> In a multichannel setup, it was observed that a few fields were not being
> copied over to the secondary channels, which impacted performance in cases
> where these options were relevant but not properly synchronized. To address
> this, this patch introduces copying the following parameters from the
> primary channel to the secondary channels:
>
> - min_offload
> - compression.requested
> - dfs_conn
> - ignore_signature
> - leaf_fullpath
> - noblockcnt
> - retrans
> - sign
>
> By copying these parameters, we ensure consistency across channels and
> prevent performance degradation due to missing or outdated settings.
>
> Signed-off-by: Aman <aman1@microsoft.com>
> ---
>  fs/smb/client/connect.c |  1 +
>  fs/smb/client/sess.c    | 10 ++++++++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
> index eaa6be445..eb82458eb 100644
> --- a/fs/smb/client/connect.c
> +++ b/fs/smb/client/connect.c
> @@ -1721,6 +1721,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
>  	/* Grab netns reference for this server. */
>  	cifs_set_net_ns(tcp_ses, get_net(current->nsproxy->net_ns));
>  
> +	tcp_ses->sign = ctx->sign;
>  	tcp_ses->conn_id = atomic_inc_return(&tcpSesNextId);
>  	tcp_ses->noblockcnt = ctx->rootfs;
>  	tcp_ses->noblocksnd = ctx->noblocksnd || ctx->rootfs;
> diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
> index 91d4d409c..fdbd32a13 100644
> --- a/fs/smb/client/sess.c
> +++ b/fs/smb/client/sess.c
> @@ -522,6 +522,16 @@ cifs_ses_add_channel(struct cifs_ses *ses,
>  	ctx->sockopt_tcp_nodelay = ses->server->tcp_nodelay;
>  	ctx->echo_interval = ses->server->echo_interval / HZ;
>  	ctx->max_credits = ses->server->max_credits;
> +	ctx->min_offload = ses->server->min_offload;
> +	ctx->compress = ses->server->compression.requested;
> +	ctx->dfs_conn = ses->server->dfs_conn;
> +	ctx->ignore_signature = ses->server->ignore_signature;
> +
> +	if (ses->server->leaf_fullpath)
> +		ctx->leaf_fullpath = kstrdup(ses->server->leaf_fullpath, GFP_KERNEL);

You're missing NULL check in case kstrdup() fails and also leaking
@ctx->leaf_fullpath.

You don't need to kstrdup() it as cifs_get_tcp_session() will already do it.

Simply assign @ctx->leaf_fullpath to @ses->server->leaf_fullpath before
calling cifs_get_tcp_session().

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels.
  2025-02-14 12:43 [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels aman1cifs
  2025-02-14 12:43 ` [PATCH 2/2] CIFS: adds min_offload and other params to cifs_debug aman1cifs
  2025-02-27 16:33 ` [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels Paulo Alcantara
@ 2025-03-06 17:46 ` aman1cifs
  2025-03-11  3:25   ` Steve French
  2 siblings, 1 reply; 9+ messages in thread
From: aman1cifs @ 2025-03-06 17:46 UTC (permalink / raw)
  To: linux-cifs, sfrench, pc, sprasad, tom, ronniesahlberg, bharathsm,
	psachdeva
  Cc: Aman

From: Aman <aman1@microsoft.com>

In a multichannel setup, it was observed that a few fields were not being
copied over to the secondary channels, which impacted performance in cases
where these options were relevant but not properly synchronized. To address
this, this patch introduces copying the following parameters from the
primary channel to the secondary channels:

- min_offload
- compression.requested
- dfs_conn
- ignore_signature
- leaf_fullpath
- noblockcnt
- retrans
- sign

By copying these parameters, we ensure consistency across channels and
prevent performance degradation due to missing or outdated settings.

Signed-off-by: Aman <aman1@microsoft.com>
---
 fs/smb/client/connect.c | 1 +
 fs/smb/client/sess.c    | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index eaa6be445..eb82458eb 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -1721,6 +1721,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
 	/* Grab netns reference for this server. */
 	cifs_set_net_ns(tcp_ses, get_net(current->nsproxy->net_ns));
 
+	tcp_ses->sign = ctx->sign;
 	tcp_ses->conn_id = atomic_inc_return(&tcpSesNextId);
 	tcp_ses->noblockcnt = ctx->rootfs;
 	tcp_ses->noblocksnd = ctx->noblocksnd || ctx->rootfs;
diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
index 91d4d409c..b4d76a37a 100644
--- a/fs/smb/client/sess.c
+++ b/fs/smb/client/sess.c
@@ -522,6 +522,13 @@ cifs_ses_add_channel(struct cifs_ses *ses,
 	ctx->sockopt_tcp_nodelay = ses->server->tcp_nodelay;
 	ctx->echo_interval = ses->server->echo_interval / HZ;
 	ctx->max_credits = ses->server->max_credits;
+	ctx->min_offload = ses->server->min_offload;
+	ctx->compress = ses->server->compression.requested;
+	ctx->dfs_conn = ses->server->dfs_conn;
+	ctx->ignore_signature = ses->server->ignore_signature;
+	ctx->leaf_fullpath = ses->server->leaf_fullpath;
+	ctx->rootfs = ses->server->noblockcnt;
+	ctx->retrans = ses->server->retrans;
 
 	/*
 	 * This will be used for encoding/decoding user/domain/pw
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels.
  2025-03-06 17:46 ` aman1cifs
@ 2025-03-11  3:25   ` Steve French
  2025-03-11 11:21     ` aman
  0 siblings, 1 reply; 9+ messages in thread
From: Steve French @ 2025-03-11  3:25 UTC (permalink / raw)
  To: aman1cifs
  Cc: linux-cifs, sfrench, pc, sprasad, tom, ronniesahlberg, bharathsm,
	psachdeva, Aman

Was doing some testing with this and tried an experiment with
multichannel and "sign" mount parm - and it looks like even without
the fix, we do sign on all channels even though tcp_ses->sign was not
updated on the secondary channels.  Do you have a reproduction
scenario for the signing issue?

On Thu, Mar 6, 2025 at 11:47 AM <aman1cifs@gmail.com> wrote:
>
> From: Aman <aman1@microsoft.com>
>
> In a multichannel setup, it was observed that a few fields were not being
> copied over to the secondary channels, which impacted performance in cases
> where these options were relevant but not properly synchronized. To address
> this, this patch introduces copying the following parameters from the
> primary channel to the secondary channels:
>
> - min_offload
> - compression.requested
> - dfs_conn
> - ignore_signature
> - leaf_fullpath
> - noblockcnt
> - retrans
> - sign
>
> By copying these parameters, we ensure consistency across channels and
> prevent performance degradation due to missing or outdated settings.
>
> Signed-off-by: Aman <aman1@microsoft.com>
> ---
>  fs/smb/client/connect.c | 1 +
>  fs/smb/client/sess.c    | 7 +++++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
> index eaa6be445..eb82458eb 100644
> --- a/fs/smb/client/connect.c
> +++ b/fs/smb/client/connect.c
> @@ -1721,6 +1721,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
>         /* Grab netns reference for this server. */
>         cifs_set_net_ns(tcp_ses, get_net(current->nsproxy->net_ns));
>
> +       tcp_ses->sign = ctx->sign;
>         tcp_ses->conn_id = atomic_inc_return(&tcpSesNextId);
>         tcp_ses->noblockcnt = ctx->rootfs;
>         tcp_ses->noblocksnd = ctx->noblocksnd || ctx->rootfs;
> diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
> index 91d4d409c..b4d76a37a 100644
> --- a/fs/smb/client/sess.c
> +++ b/fs/smb/client/sess.c
> @@ -522,6 +522,13 @@ cifs_ses_add_channel(struct cifs_ses *ses,
>         ctx->sockopt_tcp_nodelay = ses->server->tcp_nodelay;
>         ctx->echo_interval = ses->server->echo_interval / HZ;
>         ctx->max_credits = ses->server->max_credits;
> +       ctx->min_offload = ses->server->min_offload;
> +       ctx->compress = ses->server->compression.requested;
> +       ctx->dfs_conn = ses->server->dfs_conn;
> +       ctx->ignore_signature = ses->server->ignore_signature;
> +       ctx->leaf_fullpath = ses->server->leaf_fullpath;
> +       ctx->rootfs = ses->server->noblockcnt;
> +       ctx->retrans = ses->server->retrans;
>
>         /*
>          * This will be used for encoding/decoding user/domain/pw
> --
> 2.43.0
>
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels.
  2025-03-11  3:25   ` Steve French
@ 2025-03-11 11:21     ` aman
  0 siblings, 0 replies; 9+ messages in thread
From: aman @ 2025-03-11 11:21 UTC (permalink / raw)
  To: Steve French
  Cc: linux-cifs, sfrench, pc, sprasad, tom, ronniesahlberg, bharathsm,
	psachdeva, Aman

`srv_sign_required` and `mnt_sign_required` when true, override the
sign value for each session. If the srv_sign_required or
mnt_sign_required are not true, then the sign value will not be copied
from the primary to secondary without our fix.

The logic can be found in fs/smb/client/connect.c:
```
int
cifs_enable_signing(struct TCP_Server_Info *server, bool mnt_sign_required)
{
bool srv_sign_required = server->sec_mode & server->vals->signing_required;
bool srv_sign_enabled = server->sec_mode & server->vals->signing_enabled;
bool mnt_sign_enabled;

/*
* Is signing required by mnt options? If not then check
* global_secflags to see if it is there.
*/
if (!mnt_sign_required)
mnt_sign_required = ((global_secflags & CIFSSEC_MUST_SIGN) ==
CIFSSEC_MUST_SIGN);

/*
* If signing is required then it's automatically enabled too,
* otherwise, check to see if the secflags allow it.
*/
mnt_sign_enabled = mnt_sign_required ? mnt_sign_required :
(global_secflags & CIFSSEC_MAY_SIGN);

/* If server requires signing, does client allow it? */
if (srv_sign_required) {
if (!mnt_sign_enabled) {
cifs_dbg(VFS, "Server requires signing, but it's disabled in SecurityFlags!\n");
return -EOPNOTSUPP;
}
server->sign = true;
}

/* If client requires signing, does server allow it? */
if (mnt_sign_required) {
if (!srv_sign_enabled) {
cifs_dbg(VFS, "Server does not support signing!\n");
return -EOPNOTSUPP;
}
server->sign = true;
}
```


On Tue, Mar 11, 2025 at 8:56 AM Steve French <smfrench@gmail.com> wrote:
>
> Was doing some testing with this and tried an experiment with
> multichannel and "sign" mount parm - and it looks like even without
> the fix, we do sign on all channels even though tcp_ses->sign was not
> updated on the secondary channels.  Do you have a reproduction
> scenario for the signing issue?
>
> On Thu, Mar 6, 2025 at 11:47 AM <aman1cifs@gmail.com> wrote:
> >
> > From: Aman <aman1@microsoft.com>
> >
> > In a multichannel setup, it was observed that a few fields were not being
> > copied over to the secondary channels, which impacted performance in cases
> > where these options were relevant but not properly synchronized. To address
> > this, this patch introduces copying the following parameters from the
> > primary channel to the secondary channels:
> >
> > - min_offload
> > - compression.requested
> > - dfs_conn
> > - ignore_signature
> > - leaf_fullpath
> > - noblockcnt
> > - retrans
> > - sign
> >
> > By copying these parameters, we ensure consistency across channels and
> > prevent performance degradation due to missing or outdated settings.
> >
> > Signed-off-by: Aman <aman1@microsoft.com>
> > ---
> >  fs/smb/client/connect.c | 1 +
> >  fs/smb/client/sess.c    | 7 +++++++
> >  2 files changed, 8 insertions(+)
> >
> > diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
> > index eaa6be445..eb82458eb 100644
> > --- a/fs/smb/client/connect.c
> > +++ b/fs/smb/client/connect.c
> > @@ -1721,6 +1721,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
> >         /* Grab netns reference for this server. */
> >         cifs_set_net_ns(tcp_ses, get_net(current->nsproxy->net_ns));
> >
> > +       tcp_ses->sign = ctx->sign;
> >         tcp_ses->conn_id = atomic_inc_return(&tcpSesNextId);
> >         tcp_ses->noblockcnt = ctx->rootfs;
> >         tcp_ses->noblocksnd = ctx->noblocksnd || ctx->rootfs;
> > diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
> > index 91d4d409c..b4d76a37a 100644
> > --- a/fs/smb/client/sess.c
> > +++ b/fs/smb/client/sess.c
> > @@ -522,6 +522,13 @@ cifs_ses_add_channel(struct cifs_ses *ses,
> >         ctx->sockopt_tcp_nodelay = ses->server->tcp_nodelay;
> >         ctx->echo_interval = ses->server->echo_interval / HZ;
> >         ctx->max_credits = ses->server->max_credits;
> > +       ctx->min_offload = ses->server->min_offload;
> > +       ctx->compress = ses->server->compression.requested;
> > +       ctx->dfs_conn = ses->server->dfs_conn;
> > +       ctx->ignore_signature = ses->server->ignore_signature;
> > +       ctx->leaf_fullpath = ses->server->leaf_fullpath;
> > +       ctx->rootfs = ses->server->noblockcnt;
> > +       ctx->retrans = ses->server->retrans;
> >
> >         /*
> >          * This will be used for encoding/decoding user/domain/pw
> > --
> > 2.43.0
> >
> >
>
>
> --
> Thanks,
>
> Steve

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels.
       [not found] <Z66BwJnHAI8zDOzP@linuxbox.oloxx3b4wsrernbskgt3tooxxe.gx.internal.cloudapp.net>
@ 2025-03-28  6:13 ` aman1cifs
  2025-03-28  7:19   ` Shyam Prasad N
  0 siblings, 1 reply; 9+ messages in thread
From: aman1cifs @ 2025-03-28  6:13 UTC (permalink / raw)
  To: linux-cifs, sfrench, pc, sprasad, tom, ronniesahlberg, bharathsm,
	psachdeva
  Cc: Aman

From: Aman <aman1@microsoft.com>

In a multichannel setup, it was observed that a few fields were not being
copied over to the secondary channels, which impacted performance in cases
where these options were relevant but not properly synchronized. To address
this, this patch introduces copying the following parameters from the
primary channel to the secondary channels:

- min_offload
- retrans

By copying these parameters, we ensure consistency across channels and
prevent performance degradation due to missing or outdated settings.

Signed-off-by: Aman <aman1@microsoft.com>
---
 fs/smb/client/sess.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
index 91d4d409c..35ae7ad3b 100644
--- a/fs/smb/client/sess.c
+++ b/fs/smb/client/sess.c
@@ -522,6 +522,8 @@ cifs_ses_add_channel(struct cifs_ses *ses,
 	ctx->sockopt_tcp_nodelay = ses->server->tcp_nodelay;
 	ctx->echo_interval = ses->server->echo_interval / HZ;
 	ctx->max_credits = ses->server->max_credits;
+	ctx->min_offload = ses->server->min_offload;
+	ctx->retrans = ses->server->retrans;
 
 	/*
 	 * This will be used for encoding/decoding user/domain/pw
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels.
  2025-03-28  6:13 ` aman1cifs
@ 2025-03-28  7:19   ` Shyam Prasad N
  0 siblings, 0 replies; 9+ messages in thread
From: Shyam Prasad N @ 2025-03-28  7:19 UTC (permalink / raw)
  To: aman1cifs
  Cc: linux-cifs, sfrench, pc, sprasad, tom, ronniesahlberg, bharathsm,
	psachdeva, Aman

On Fri, Mar 28, 2025 at 11:43 AM <aman1cifs@gmail.com> wrote:
>
> From: Aman <aman1@microsoft.com>
>
> In a multichannel setup, it was observed that a few fields were not being
> copied over to the secondary channels, which impacted performance in cases
> where these options were relevant but not properly synchronized. To address
> this, this patch introduces copying the following parameters from the
> primary channel to the secondary channels:
>
> - min_offload
> - retrans
>
> By copying these parameters, we ensure consistency across channels and
> prevent performance degradation due to missing or outdated settings.
>
> Signed-off-by: Aman <aman1@microsoft.com>
> ---
>  fs/smb/client/sess.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
> index 91d4d409c..35ae7ad3b 100644
> --- a/fs/smb/client/sess.c
> +++ b/fs/smb/client/sess.c
> @@ -522,6 +522,8 @@ cifs_ses_add_channel(struct cifs_ses *ses,
>         ctx->sockopt_tcp_nodelay = ses->server->tcp_nodelay;
>         ctx->echo_interval = ses->server->echo_interval / HZ;
>         ctx->max_credits = ses->server->max_credits;
> +       ctx->min_offload = ses->server->min_offload;
> +       ctx->retrans = ses->server->retrans;
>
>         /*
>          * This will be used for encoding/decoding user/domain/pw
> --
> 2.43.0
>
>

Looks good to me. These are low risk and I've validated that this
change works as a part of my multichannel test runs.

-- 
Regards,
Shyam

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-03-28  7:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-14 12:43 [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels aman1cifs
2025-02-14 12:43 ` [PATCH 2/2] CIFS: adds min_offload and other params to cifs_debug aman1cifs
2025-02-14 17:55   ` Steve French
2025-02-27 16:33 ` [PATCH 1/2] CIFS: Propagate min offload along with other parameters from primary to secondary channels Paulo Alcantara
2025-03-06 17:46 ` aman1cifs
2025-03-11  3:25   ` Steve French
2025-03-11 11:21     ` aman
     [not found] <Z66BwJnHAI8zDOzP@linuxbox.oloxx3b4wsrernbskgt3tooxxe.gx.internal.cloudapp.net>
2025-03-28  6:13 ` aman1cifs
2025-03-28  7:19   ` Shyam Prasad N

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox