I rebased some of Aurelien's series (here is first patch in series that deals with parsing his new mount options) ontop of current for-next (not merged into for-next though - needs more testing etc.) -- Thanks, Steve
From 30d3c2ff99d916e7db2f8f921debd9b75f7c2d97 Mon Sep 17 00:00:00 2001 From: Aurelien Aptel <aaptel@xxxxxxxx> Date: Tue, 25 Jun 2019 12:52:25 -0500 Subject: [PATCH] smb3: Add mount options for multichannel support Add mount option parsing for "multichannel" and "max_channels=" Followon patches add additional support for setting up and using the channels. Signed-off-by: Aurelien Aptel <aaptel@xxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> --- fs/cifs/cifsglob.h | 5 +++++ fs/cifs/connect.c | 26 ++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index dd99d0318b77..e06e5dd80193 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -86,6 +86,9 @@ /* maximum number of PDUs in one compound */ #define MAX_COMPOUND 5 +/* maximum number of channels (socket connections) in multichannel use case */ +#define CIFS_MAX_CHANNELS 16 + /* * Default number of credits to keep available for SMB3. * This value is chosen somewhat arbitrarily. The Windows client @@ -586,6 +589,7 @@ struct smb_vol { bool resilient:1; /* noresilient not required since not fored for CA */ bool domainauto:1; bool rdma:1; + bool multichannel:1; unsigned int bsize; unsigned int rsize; unsigned int wsize; @@ -600,6 +604,7 @@ struct smb_vol { unsigned int echo_interval; /* echo interval in secs */ __u64 snapshot_time; /* needed for timewarp tokens */ __u32 handle_timeout; /* persistent and durable handle timeout in ms */ + unsigned int max_channels; unsigned int max_credits; /* smb3 max_credits 10 < credits < 60000 */ __u16 compression; /* compression algorithm 0xFFFF default 0=disabled */ }; diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index da85a251a609..a7c8a03f61d2 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -97,7 +97,7 @@ enum { Opt_persistent, Opt_nopersistent, Opt_resilient, Opt_noresilient, Opt_domainauto, Opt_rdma, Opt_modeace, - Opt_compress, + Opt_compress, Opt_multichannel, Opt_nomultichannel, /* Mount options which take numeric value */ Opt_backupuid, Opt_backupgid, Opt_uid, @@ -105,7 +105,7 @@ enum { Opt_dirmode, Opt_port, Opt_blocksize, Opt_rsize, Opt_wsize, Opt_actimeo, Opt_echo_interval, Opt_max_credits, Opt_handletimeout, - Opt_snapshot, + Opt_snapshot, Opt_max_channels, /* Mount options which take string value */ Opt_user, Opt_pass, Opt_ip, @@ -196,6 +196,8 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_noresilient, "noresilienthandles"}, { Opt_domainauto, "domainauto"}, { Opt_rdma, "rdma"}, + { Opt_multichannel, "multichannel" }, + { Opt_nomultichannel, "nomultichannel" }, { Opt_backupuid, "backupuid=%s" }, { Opt_backupgid, "backupgid=%s" }, @@ -215,6 +217,7 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_max_credits, "max_credits=%s" }, { Opt_snapshot, "snapshot=%s" }, { Opt_compress, "compress=%s" }, + { Opt_max_channels, "max_channels=%s" }, { Opt_blank_user, "user=" }, { Opt_blank_user, "username=" }, @@ -1636,6 +1639,10 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, vol->echo_interval = SMB_ECHO_INTERVAL_DEFAULT; + /* default to no multichannel (single server connection) */ + vol->multichannel = false; + vol->max_channels = 1; + if (!mountdata) goto cifs_parse_mount_err; @@ -1922,6 +1929,12 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, cifs_dbg(VFS, "SMB3 compression support is experimental\n"); break; + case Opt_multichannel: + vol->multichannel = true; + break; + case Opt_nomultichannel: + vol->multichannel = false; + break; /* Numeric Values */ case Opt_backupuid: @@ -2073,6 +2086,15 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, } vol->max_credits = option; break; + case Opt_max_channels: + if (get_option_ul(args, &option) || option < 1 || + option > CIFS_MAX_CHANNELS) { + cifs_dbg(VFS, "%s: Invalid max_channels value, needs to be 1-%d\n", + __func__, CIFS_MAX_CHANNELS); + goto cifs_parse_mount_err; + } + vol->max_channels = option; + break; /* String Arguments */ -- 2.20.1