cifs: new mount option called retrans
authorSteve French <stfrench@microsoft.com>
Mon, 29 Jan 2024 01:41:05 +0000 (19:41 -0600)
committerSteve French <stfrench@microsoft.com>
Mon, 29 Jan 2024 01:41:05 +0000 (19:41 -0600)
We have several places in the code where we treat the
error -EAGAIN very differently. Some code retry for
arbitrary number of times.

Introducing this new mount option named "retrans", so
that all these handlers of -EAGAIN can retry a fixed
number of times. This applies only to soft mounts.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/cifsfs.c
fs/cifs/cifsglob.h
fs/cifs/connect.c
fs/cifs/fs_context.c
fs/cifs/fs_context.h

index b9a9e5b35cbc9133d690de86a3caf9dd0bb6cd4b..dfd600d77b1750e7110529feaed2b5aa37073ab0 100644 (file)
@@ -676,6 +676,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
                seq_printf(s, ",rasize=%u", cifs_sb->ctx->rasize);
        if (tcon->ses->server->min_offload)
                seq_printf(s, ",esize=%u", tcon->ses->server->min_offload);
+       if (tcon->ses->server->retrans)
+               seq_printf(s, ",retrans=%u", tcon->ses->server->retrans);
        seq_printf(s, ",echo_interval=%lu",
                        tcon->ses->server->echo_interval / HZ);
 
index 23f0a60dad9caab4e1cdfe94cc0a31e928dcdff6..6defe692ad8d69aafdb876fe6a31bffd3b6737bc 100644 (file)
@@ -756,6 +756,7 @@ struct TCP_Server_Info {
        unsigned int    max_read;
        unsigned int    max_write;
        unsigned int    min_offload;
+       unsigned int    retrans;
        __le16  compress_algorithm;
        __u16   signing_algorithm;
        __le16  cipher_type;
index a5fb4fe6cbb839c2c1d10d75b30126b82419382c..428d9cee4214dc754bf2b31986053f2b48def1b2 100644 (file)
@@ -1573,6 +1573,9 @@ static int match_server(struct TCP_Server_Info *server,
        if (server->min_offload != ctx->min_offload)
                return 0;
 
+       if (server->retrans != ctx->retrans)
+               return 0;
+
        return 1;
 }
 
@@ -1801,6 +1804,7 @@ smbd_connected:
                goto out_err_crypto_release;
        }
        tcp_ses->min_offload = ctx->min_offload;
+       tcp_ses->retrans = ctx->retrans;
        /*
         * at this point we are the only ones with the pointer
         * to the struct since the kernel thread not created yet
index a3493da12ad1e6cbac7249f3e8464cf7eeff542e..52cbef2eeb28f6ba0013063b4bafcecc08c3a02d 100644 (file)
@@ -139,6 +139,7 @@ const struct fs_parameter_spec smb3_fs_parameters[] = {
        fsparam_u32("dir_mode", Opt_dirmode),
        fsparam_u32("port", Opt_port),
        fsparam_u32("min_enc_offload", Opt_min_enc_offload),
+       fsparam_u32("retrans", Opt_retrans),
        fsparam_u32("esize", Opt_min_enc_offload),
        fsparam_u32("bsize", Opt_blocksize),
        fsparam_u32("rasize", Opt_rasize),
@@ -1064,6 +1065,9 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
        case Opt_min_enc_offload:
                ctx->min_offload = result.uint_32;
                break;
+       case Opt_retrans:
+               ctx->retrans = result.uint_32;
+               break;
        case Opt_blocksize:
                /*
                 * inode blocksize realistically should never need to be
@@ -1619,6 +1623,8 @@ int smb3_init_fs_context(struct fs_context *fc)
        ctx->backupuid_specified = false; /* no backup intent for a user */
        ctx->backupgid_specified = false; /* no backup intent for a group */
 
+       ctx->retrans = 1;
+
 /*
  *     short int override_uid = -1;
  *     short int override_gid = -1;
index cf46916286d029a9bd36ea4980786456bd11449f..182ce11cbe9362eccf73eebadcdcfc2ee7ac7988 100644 (file)
@@ -118,6 +118,7 @@ enum cifs_param {
        Opt_file_mode,
        Opt_dirmode,
        Opt_min_enc_offload,
+       Opt_retrans,
        Opt_blocksize,
        Opt_rasize,
        Opt_rsize,
@@ -245,6 +246,7 @@ struct smb3_fs_context {
        unsigned int rsize;
        unsigned int wsize;
        unsigned int min_offload;
+       unsigned int retrans;
        bool sockopt_tcp_nodelay:1;
        /* attribute cache timemout for files and directories in jiffies */
        unsigned long acregmax;