Hi, Pavel Shilovsky <piastryyy@xxxxxxxxx> writes: > Hi all, > > for-next branch is updated with the patches in attachments (resulting > of merging some of the patches and fixing up some minor style > problems): > > https://github.com/piastry/cifs-utils/commits/next > > Please take a look if anything is missed. Looks good to me. Thanks! Reviewed-by: Paulo Alcantara <palcantara@xxxxxxx> cheers, Paulo > > -- > Best regards, > Pavel Shilovsky > From 7cf164b0fbddcc343226df7e096ecd82080f3350 Mon Sep 17 00:00:00 2001 > From: Steve French <stfrench@xxxxxxxxxxxxx> > Date: Fri, 29 Mar 2019 03:05:55 -0500 > Subject: [PATCH 1/7] smbinfo: Add ability to query snapshots (previous > versions) > > "smbinfo list-snapshots" > > Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> > Signed-off-by: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx> > --- > smbinfo.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > smbinfo.rst | 2 ++ > 2 files changed, 109 insertions(+), 1 deletion(-) > > diff --git a/smbinfo.c b/smbinfo.c > index 33fca95..adfd85e 100644 > --- a/smbinfo.c > +++ b/smbinfo.c > @@ -89,6 +89,8 @@ usage(char *name) > " Prints the security descriptor for a cifs file.\n" > " quota:\n" > " Prints the quota for a cifs file.\n" > + " list-snapshots:\n" > + " List the previous versions of the volume that backs this file.\n" > " fsctl-getobjid:\n" > " Prints the objectid of the file and GUID of the underlying volume.\n", > name); > @@ -882,7 +884,6 @@ print_quota(unsigned char *sd) > uint32_t u32, neo; > uint64_t u64; > struct timeval tv; > - struct tm; > int i, off = 0; > > one_more: > @@ -966,6 +967,109 @@ quota(int f) > free(qi); > } > > + > +struct smb_snapshot_array { > + int32_t number_of_snapshots; > + int32_t number_of_snapshots_returned; > + int32_t snapshot_array_size; > + char snapshot_data[0]; > +}; > + > + > +#define GMT_NAME_LEN 24 /* length of a @GMT- name */ > +#define GMT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S" > + > +#define NTFS_TIME_OFFSET ((unsigned long long)(369*365 + 89) * 24 * 3600 * 10000000) > + > +static void print_snapshots(struct smb_snapshot_array *psnap) > +{ > + int current_snapshot_entry = 0; > + char gmt_token[GMT_NAME_LEN + 1] = {0}; > + int i; > + int j = 0; > + struct tm tm; > + unsigned long long dce_time; > + > + printf("Number of snapshots: %d Number of snapshots returned: %d\n", > + psnap->number_of_snapshots, > + psnap->number_of_snapshots_returned); > + printf("Snapshot list in GMT (Coordinated UTC Time) and SMB format (100 nanosecond units needed for snapshot mounts):"); > + for (i = 0; i < psnap->snapshot_array_size; i++) { > + if (psnap->snapshot_data[i] == '@') { > + j = 0; > + current_snapshot_entry++; > + printf("\n%d) GMT:", current_snapshot_entry); > + } > + if (psnap->snapshot_data[i] != 0) { > + gmt_token[j] = psnap->snapshot_data[i]; > + j++; > + } > + if (j == GMT_NAME_LEN) { > + printf("%s", gmt_token); > + j = 0; > + strptime(gmt_token, GMT_FORMAT, &tm); > + dce_time = timegm(&tm) * 10000000 + NTFS_TIME_OFFSET; > + printf("\n SMB3:%llu", dce_time); > + } > + } > + printf("\n"); > +} > + > +#define CIFS_ENUMERATE_SNAPSHOTS _IOR(CIFS_IOCTL_MAGIC, 6, struct smb_snapshot_array) > + > +#define MIN_SNAPSHOT_ARRAY_SIZE 16 /* See MS-SMB2 section 3.3.5.15.1 */ > + > +static void > +list_snapshots(int f) > +{ > + > + struct smb_snapshot_array snap_inf; > + struct smb_snapshot_array *buf; > + > + /* > + * When first field in structure we pass in here is zero, cifs.ko can > + * recognize that this is the first query and that it must set the SMB3 > + * FSCTL response buffer size (in the request) to exactly 16 bytes > + * (which is required by some servers to process the initial query) > + */ > + snap_inf.number_of_snapshots = 0; > + snap_inf.number_of_snapshots_returned = 0; > + snap_inf.snapshot_array_size = sizeof(struct smb_snapshot_array); > + > + /* Query the number of snapshots so we know how much to allocate */ > + if (ioctl(f, CIFS_ENUMERATE_SNAPSHOTS, &snap_inf) < 0) { > + fprintf(stderr, "Querying snapshots failed with %s\n", strerror(errno)); > + exit(1); > + } > + > + if (snap_inf.number_of_snapshots == 0) > + return; > + > + /* Now that we know the size, query the list from the server */ > + > + buf = malloc(snap_inf.snapshot_array_size + MIN_SNAPSHOT_ARRAY_SIZE); > + > + if (buf == NULL) { > + printf("Failed, out of memory.\n"); > + exit(1); > + } > + /* > + * first parm is non-zero which allows cifs.ko to recognize that this is > + * the second query (it has to set response buf size larger) > + */ > + buf->number_of_snapshots = snap_inf.number_of_snapshots; > + > + buf->snapshot_array_size = snap_inf.snapshot_array_size; > + > + if (ioctl(f, CIFS_ENUMERATE_SNAPSHOTS, buf) < 0) { > + fprintf(stderr, "Querying snapshots failed with %s\n", strerror(errno)); > + exit(1); > + } > + > + print_snapshots(buf); > + free(buf); > +} > + > int main(int argc, char *argv[]) > { > int c; > @@ -1016,6 +1120,8 @@ int main(int argc, char *argv[]) > secdesc(f); > else if (!strcmp(argv[optind], "quota")) > quota(f); > + else if (!strcmp(argv[optind], "list-snapshots")) > + list_snapshots(f); > else if (!strcmp(argv[1], "fsctl-getobjid")) > fsctlgetobjid(f); > else { > diff --git a/smbinfo.rst b/smbinfo.rst > index fd7f0ff..0c96050 100644 > --- a/smbinfo.rst > +++ b/smbinfo.rst > @@ -64,6 +64,8 @@ COMMAND > > `fsctl-getobjid`: Prints the ObjectID > > +`list-snapshots`: Lists the previous versions of the volume that backs this file > + > `quota`: Print the quota for the volume in the form > - SID Length > - Change Time > -- > 2.7.4 > > From e8b8bb5fa61c53b05975650194da24786c4a4f32 Mon Sep 17 00:00:00 2001 > From: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx> > Date: Wed, 3 Apr 2019 22:42:10 +0000 > Subject: [PATCH 5/7] mount.cifs: detect GMT format of snapshot version > > In order to provide an easy way to access snapshots a GMT > token string should be allowed as a "snapshot" mount option > argument, not SMB 100-nanoseconds time only. Detect if the > argument is in GMT format and convert it to SMB 100-nanoseconds > time before passing to the kernel. > > Signed-off-by: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx> > --- > mount.cifs.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++------- > 1 file changed, 47 insertions(+), 7 deletions(-) > > diff --git a/mount.cifs.c b/mount.cifs.c > index c6a1bd6..b3235e4 100644 > --- a/mount.cifs.c > +++ b/mount.cifs.c > @@ -43,6 +43,7 @@ > #include <limits.h> > #include <paths.h> > #include <libgen.h> > +#include <time.h> > #include <sys/mman.h> > #include <sys/wait.h> > #ifdef HAVE_SYS_FSUID_H > @@ -161,10 +162,16 @@ > #define OPT_BKUPUID 30 > #define OPT_BKUPGID 31 > #define OPT_NOFAIL 32 > +#define OPT_SNAPSHOT 33 > > #define MNT_TMP_FILE "/.mtab.cifs.XXXXXX" > > -/* struct for holding parsed mount info for use by privleged process */ > +#define GMT_NAME_LEN 24 /* length of a @GMT- name */ > +#define GMT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S" > + > +#define NTFS_TIME_OFFSET ((unsigned long long)(369*365 + 89) * 24 * 3600 * 10000000) > + > +/* struct for holding parsed mount info for use by privileged process */ > struct parsed_mount_info { > unsigned long flags; > char host[NI_MAXHOST + 1]; > @@ -271,9 +278,9 @@ static int mount_usage(FILE * stream) > fprintf(stream, > "\n\tcache=<strict|none|loose>,nounix,cifsacl,sec=<authentication mechanism>,"); > fprintf(stream, > - "\n\tsign,seal,fsc,snapshot=<time>,nosharesock,persistenthandles,resilienthandles,"); > + "\n\tsign,seal,fsc,snapshot=<token|time>,nosharesock,persistenthandles,"); > fprintf(stream, > - "\n\trdma,vers=<smb_dialect>,cruid"); > + "\n\tresilienthandles,rdma,vers=<smb_dialect>,cruid"); > fprintf(stream, > "\n\nOptions not needed for servers supporting CIFS Unix extensions"); > fprintf(stream, > @@ -773,6 +780,8 @@ static int parse_opt_token(const char *token) > return OPT_NOFAIL; > if (strncmp(token, "x-", 2) == 0) > return OPT_IGNORE; > + if (strncmp(token, "snapshot", 8) == 0) > + return OPT_SNAPSHOT; > > return OPT_ERROR; > } > @@ -793,16 +802,19 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) > int got_uid = 0; > int got_cruid = 0; > int got_gid = 0; > + int got_snapshot = 0; > uid_t uid, cruid = 0, bkupuid = 0; > gid_t gid, bkupgid = 0; > char *ep; > struct passwd *pw; > struct group *gr; > /* > - * max 32-bit uint in decimal is 4294967295 which is 10 chars wide > - * +1 for NULL, and +1 for good measure > + * max 64-bit uint in decimal is 18446744073709551615 which is 20 chars > + * wide +1 for NULL, and +1 for good measure > */ > - char txtbuf[12]; > + char txtbuf[22]; > + unsigned long long snapshot; > + struct tm tm; > > /* make sure we're starting from beginning */ > out[0] = '\0'; > @@ -1130,6 +1142,19 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) > case OPT_NOFAIL: > parsed_info->nofail = 1; > goto nocopy; > + case OPT_SNAPSHOT: > + if (!value || !*value) > + goto nocopy; > + if (strncmp(value, "@GMT-", 5)) > + break; > + if ((strlen(value) != GMT_NAME_LEN) || > + (strptime(value, GMT_FORMAT, &tm) == NULL)) { > + fprintf(stderr, "bad snapshot token\n"); > + return EX_USAGE; > + } > + snapshot = timegm(&tm) * 10000000 + NTFS_TIME_OFFSET; > + got_snapshot = 1; > + goto nocopy; > } > > /* check size before copying option to buffer */ > @@ -1225,7 +1250,7 @@ nocopy: > if (got_bkupgid) { > word_len = snprintf(txtbuf, sizeof(txtbuf), "%u", bkupgid); > > - /* comma + "backkupgid=" + terminating NULL == 12 */ > + /* comma + "backupgid=" + terminating NULL == 12 */ > if (out_len + word_len + 12 > MAX_OPTIONS_LEN) { > fprintf(stderr, "Options string too long\n"); > return EX_USAGE; > @@ -1237,6 +1262,21 @@ nocopy: > } > snprintf(out + out_len, word_len + 11, "backupgid=%s", txtbuf); > } > + if (got_snapshot) { > + word_len = snprintf(txtbuf, sizeof(txtbuf), "%llu", snapshot); > + > + /* comma + "snapshot=" + terminating NULL == 11 */ > + if (out_len + word_len + 11 > MAX_OPTIONS_LEN) { > + fprintf(stderr, "Options string too long\n"); > + return EX_USAGE; > + } > + > + if (out_len) { > + strlcat(out, ",", MAX_OPTIONS_LEN); > + out_len++; > + } > + snprintf(out + out_len, word_len + 11, "snapshot=%s", txtbuf); > + } > > return 0; > } > -- > 2.7.4 > > From 6ef851043c4a36be0b0657d4d3cf3a1ab9be6efb Mon Sep 17 00:00:00 2001 > From: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx> > Date: Wed, 3 Apr 2019 12:24:33 -0700 > Subject: [PATCH 4/7] mount.cifs: add more options to help message > > Signed-off-by: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx> > --- > mount.cifs.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/mount.cifs.c b/mount.cifs.c > index d921fed..c6a1bd6 100644 > --- a/mount.cifs.c > +++ b/mount.cifs.c > @@ -267,13 +267,13 @@ static int mount_usage(FILE * stream) > fprintf(stream, > "\n\tsep=<char>,iocharset=<codepage>,suid,nosuid,exec,noexec,serverino,"); > fprintf(stream, > - "\n\tmapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>"); > + "\n\tnoserverino,mapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>"); > fprintf(stream, > - "\n\tdirectio,nounix,cifsacl,sec=<authentication mechanism>,sign,seal,fsc,"); > + "\n\tcache=<strict|none|loose>,nounix,cifsacl,sec=<authentication mechanism>,"); > fprintf(stream, > - "\n\tsnapshot=<time>,nosharesock,persistenthandles,resilienthandles,rdma,"); > + "\n\tsign,seal,fsc,snapshot=<time>,nosharesock,persistenthandles,resilienthandles,"); > fprintf(stream, > - "\n\tvers=<smb_dialect>,cruid"); > + "\n\trdma,vers=<smb_dialect>,cruid"); > fprintf(stream, > "\n\nOptions not needed for servers supporting CIFS Unix extensions"); > fprintf(stream, > @@ -290,7 +290,9 @@ static int mount_usage(FILE * stream) > fprintf(stream, > "\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=<path>,nobrl,"); > fprintf(stream, > - "\n\techo_interval=<seconds>,actimeo=<seconds>,max_credits=<credits>"); > + "\n\techo_interval=<seconds>,actimeo=<seconds>,max_credits=<credits>,"); > + fprintf(stream, > + "\n\tbsize=<size>"); > fprintf(stream, > "\n\nOptions are described in more detail in the manual page"); > fprintf(stream, "\n\tman 8 mount.cifs\n"); > -- > 2.7.4 > > From 213a508997303dfead74154edf9d137e911e84a0 Mon Sep 17 00:00:00 2001 > From: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx> > Date: Tue, 2 Apr 2019 11:40:40 -0700 > Subject: [PATCH 2/7] smbinfo: make argument order consistent > > Signed-off-by: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx> > --- > smbinfo.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/smbinfo.c b/smbinfo.c > index adfd85e..f9de7fd 100644 > --- a/smbinfo.c > +++ b/smbinfo.c > @@ -85,14 +85,14 @@ usage(char *name) > " Prints FilePositionInfo for a cifs file.\n" > " filestandardinfo:\n" > " Prints FileStandardInfo for a cifs file.\n" > - " secdesc:\n" > - " Prints the security descriptor for a cifs file.\n" > - " quota:\n" > - " Prints the quota for a cifs file.\n" > + " fsctl-getobjid:\n" > + " Prints the objectid of the file and GUID of the underlying volume.\n" > " list-snapshots:\n" > " List the previous versions of the volume that backs this file.\n" > - " fsctl-getobjid:\n" > - " Prints the objectid of the file and GUID of the underlying volume.\n", > + " quota:\n" > + " Prints the quota for a cifs file.\n" > + " secdesc:\n" > + " Prints the security descriptor for a cifs file.\n", > name); > exit(1); > } > @@ -1116,14 +1116,14 @@ int main(int argc, char *argv[]) > filepositioninfo(f); > else if (!strcmp(argv[optind], "filestandardinfo")) > filestandardinfo(f); > - else if (!strcmp(argv[optind], "secdesc")) > - secdesc(f); > - else if (!strcmp(argv[optind], "quota")) > - quota(f); > + else if (!strcmp(argv[optind], "fsctl-getobjid")) > + fsctlgetobjid(f); > else if (!strcmp(argv[optind], "list-snapshots")) > list_snapshots(f); > - else if (!strcmp(argv[1], "fsctl-getobjid")) > - fsctlgetobjid(f); > + else if (!strcmp(argv[optind], "quota")) > + quota(f); > + else if (!strcmp(argv[optind], "secdesc")) > + secdesc(f); > else { > fprintf(stderr, "Unknown command %s\n", argv[optind]); > exit(1); > -- > 2.7.4 > > From 6396a77eac26b3bf15f0fdfb187282aa7d0a5bcf Mon Sep 17 00:00:00 2001 > From: Steve French <stfrench@xxxxxxxxxxxxx> > Date: Tue, 2 Apr 2019 21:18:27 -0500 > Subject: [PATCH 3/7] mount.cifs Add various missing parms from the help text > > When you type mount.cifs --help there were more than 40 mount parms > missing. Add 12 of the more common ones to what is displayed by help. > > Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> > --- > mount.cifs.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/mount.cifs.c b/mount.cifs.c > index 9370f2e..d921fed 100644 > --- a/mount.cifs.c > +++ b/mount.cifs.c > @@ -269,20 +269,28 @@ static int mount_usage(FILE * stream) > fprintf(stream, > "\n\tmapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>"); > fprintf(stream, > - "\n\tdirectio,nounix,cifsacl,sec=<authentication mechanism>,sign,seal,fsc"); > + "\n\tdirectio,nounix,cifsacl,sec=<authentication mechanism>,sign,seal,fsc,"); > + fprintf(stream, > + "\n\tsnapshot=<time>,nosharesock,persistenthandles,resilienthandles,rdma,"); > + fprintf(stream, > + "\n\tvers=<smb_dialect>,cruid"); > fprintf(stream, > "\n\nOptions not needed for servers supporting CIFS Unix extensions"); > fprintf(stream, > "\n\t(e.g. unneeded for mounts to most Samba versions):"); > fprintf(stream, > - "\n\tuid=<uid>,gid=<gid>,dir_mode=<mode>,file_mode=<mode>,sfu"); > + "\n\tuid=<uid>,gid=<gid>,dir_mode=<mode>,file_mode=<mode>,sfu,"); > + fprintf(stream, > + "\n\tmfsymlinks,idsfromsid"); > fprintf(stream, "\n\nRarely used options:"); > fprintf(stream, > "\n\tport=<tcpport>,rsize=<size>,wsize=<size>,unc=<unc_name>,ip=<ip_address>,"); > fprintf(stream, > "\n\tdev,nodev,nouser_xattr,netbiosname=<OUR_RFC1001NAME>,hard,soft,intr,"); > fprintf(stream, > - "\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=<path>,nobrl"); > + "\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=<path>,nobrl,"); > + fprintf(stream, > + "\n\techo_interval=<seconds>,actimeo=<seconds>,max_credits=<credits>"); > fprintf(stream, > "\n\nOptions are described in more detail in the manual page"); > fprintf(stream, "\n\tman 8 mount.cifs\n"); > -- > 2.7.4 > > From 19c1bb71de9f58bb5b1fbc78ab468f80df62ee57 Mon Sep 17 00:00:00 2001 > From: Steve French <stfrench@xxxxxxxxxxxxx> > Date: Wed, 3 Apr 2019 23:46:34 -0500 > Subject: [PATCH 6/7] Update man page for mount.cifs to add new options > > Add description of "snapshot" and "handletimeout" mount > options and a security section noting that the use of > cifs is discouraged, and various minor updates. > > Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> > Signed-off-by: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx> > --- > mount.cifs.rst | 98 +++++++++++++++++++++++++++++++++++----------------------- > 1 file changed, 60 insertions(+), 38 deletions(-) > > diff --git a/mount.cifs.rst b/mount.cifs.rst > index f64d1f1..8ba6e7b 100644 > --- a/mount.cifs.rst > +++ b/mount.cifs.rst > @@ -15,13 +15,13 @@ SYNOPSIS > > This tool is part of the cifs-utils suite. > > -``mount.cifs`` mounts a Linux CIFS filesystem. It is usually invoked > -indirectly by the mount(8) command when using the "-t cifs" > +``mount.cifs`` mounts a CIFS or SMB3 filesystem from Linux. It is > +usually invoked indirectly by the mount(8) command when using the "-t cifs" > option. This command only works in Linux, and the kernel must support > -the cifs filesystem. The CIFS protocol is the successor to the SMB > -protocol and is supported by most Windows servers and many other > -commercial servers and Network Attached Storage appliances as well as > -by the popular Open Source server Samba. > +the cifs filesystem. The SMB3 protocol is the successor to the CIFS (SMB) > +protocol and is supported by most Windows servers, Azure (cloud storage), > +Macs and many other commercial servers and Network Attached Storage > +appliances as well as by the popular Open Source server Samba. > > The mount.cifs utility attaches the UNC name (exported network > resource) specified as service (using ``//server/share`` syntax, where > @@ -266,6 +266,13 @@ handlecache > nohandlecache > Disable caching of the share root directory handle. > > +handletimeout=arg > + The time (in milliseconds) for which the server should reserve the handle after > + a failover waiting for the client to reconnect. When mounting with > + resilienthandles or persistenthandles mount option, or when their use is > + requested by the server (continuous availability shares) then this parameter > + overrides the server default handle timeout (which for most servers is 120 seconds). > + > rwpidforward > Forward pid of a process who opened a file to any read or write > operation on that file. This prevent applications like wine(1) from > @@ -387,6 +394,12 @@ persistenthandles > nopersistenthandles > (default) Disable persistent handles. > > +snapshot=time > + Mount a specific snapshot of the remote share. ``time`` must be a > + positive integer identifying the snapshot requested (in 100-nanosecond > + units that have elapsed since January 1, 1601, or alternatively it can > + be specified in GMT format e.g. @GMT-2019.03.27-20.52.19) > + > nobrl > Do not send byte range lock requests to the server. This is necessary > for certain applications that break with cifs style mandatory byte > @@ -401,7 +414,7 @@ locallease > Check cached leases locally instead of querying the server. > > sfu > - When the CIFS Unix Extensions are not negotiated, attempt to create > + When the CIFS or SMB3 Unix Extensions are not negotiated, attempt to create > device files and fifos in a format compatible with Services for Unix > (SFU). In addition retrieve bits 10-12 of the mode via the > ``SETFILEBITS`` extended attribute (as SFU does). In the future the > @@ -450,11 +463,11 @@ noserverino > > See section `INODE NUMBERS`_ for more information. > > -unix|linux > +posix|unix|linux > (default) Enable Unix Extensions for this mount. Requires CIFS > (vers=1.0) or SMB3.1.1 (vers=3.1.1) and a server supporting them. > > -nounix|nolinux > +noposix|nounix|nolinux > Disable the Unix Extensions for this mount. This can be useful in > order to turn off multiple settings at once. This includes POSIX acls, > POSIX locks, POSIX paths, symlink support and retrieving > @@ -479,38 +492,35 @@ nosharesock > Do not try to reuse sockets if the system is already connected to > the server via an existing mount point. This will make the client > always make a new connection to the server no matter what he is > - already connected to. > + already connected to. This can be useful in simulating multiple > + clients connecting to the same server, as each mount point > + will use a different TCP socket. > > noblocksend > Send data on the socket using non blocking operations (MSG_DONTWAIT flag). > > rsize=bytes > Maximum amount of data that the kernel will request in a read request > - in bytes. Prior to kernel 3.2.0, the default was 16k, and the maximum > - size was limited by the ``CIFSMaxBufSize`` module parameter. As of > - kernel 3.2.0, the behavior varies according to whether POSIX > - extensions are enabled on the mount and the server supports large > - POSIX reads. If they are, then the default is 1M, and the maximum is > - 16M. If they are not supported by the server, then the default is 60k > - and the maximum is around 127k. The reason for the 60k is because it's > - the maximum size read that windows servers can fill. Note that this > - value is a maximum, and the client may settle on a smaller size to > - accommodate what the server supports. In kernels prior to 3.2.0, no > - negotiation is performed. > + in bytes. Maximum size that servers will accept is typically 8MB for SMB3 > + or later dialects. Default requested during mount is 4MB. Prior to the 4.20 > + kernel the default requested was 1MB. Prior to the SMB2.1 dialect the > + maximum was usually 64K. > > wsize=bytes > Maximum amount of data that the kernel will send in a write request in > - bytes. Prior to kernel 3.0.0, the default and maximum was 57344 (14 \* > - 4096 pages). As of 3.0.0, the default depends on whether the client > - and server negotiate large writes via POSIX extensions. If they do, > - then the default is 1M, and the maximum allowed is 16M. If they do > - not, then the default is 65536 and the maximum allowed is 131007. Note > - that this value is just a starting point for negotiation in 3.0.0 and > - up. The client and server may negotiate this size downward according > - to the server's capabilities. In kernels prior to 3.0.0, no > - negotiation is performed. It can end up with an existing superblock if > - this value isn't specified or it's greater or equal than the existing > - one. > + bytes. Maximum size that servers will accept is typically 8MB for SMB3 > + or later dialects. Default requested during mount is 4MB. Prior to the 4.20 > + kernel the default requested was 1MB. Prior to the SMB2.1 dialect the > + maximum was usually 64K. > + > +bsize=bytes > + Override the default blocksize (1MB) reported on SMB3 files (requires > + kernel version of 5.1 or later). Prior to kernel version 5.1, the > + blocksize was always reported as 16K instead of 1MB (and was not > + configurable) which can hurt the performance of tools like cp and scp > + (especially for uncached I/O) which decide on the read and write size > + to use for file copies based on the inode blocksize. bsize may not be > + less than 16K or greater than 16M. > > max_credits=n > Maximum credits the SMB2 client can have. Default is 32000. Must be > @@ -885,14 +895,26 @@ CONFIGURATION > The primary mechanism for making configuration changes and for reading > debug information for the cifs vfs is via the Linux /proc > filesystem. In the directory */proc/fs/cifs* are various > -configuration files and pseudo files which can display debug > -information. There are additional startup options such as maximum > -buffer size and number of buffers which only may be set when the > +configuration files and pseudo files which can display debug information > +and performance statistics. There are additional startup options such as > +maximum buffer size and number of buffers which only may be set when the > kernel cifs vfs (cifs.ko module) is loaded. These can be seen by > running the ``modinfo`` utility against the file cifs.ko which will > list the options that may be passed to cifs during module installation > (device driver load). For more information see the kernel file > -*fs/cifs/README*. > +*fs/cifs/README*. When configuring dynamic tracing (trace-cmd) > +note that the list of SMB3 events which can be enabled can be seen at: > +*/sys/kernel/debug/tracing/events/cifs/*. > + > +******** > +SECURITY > +******** > + > +The use of SMB2.1 or later (including the latest dialect SMB3.1.1) > +is recommended for improved security and SMB1 is no longer requested > +by default at mount time. Old dialects such as CIFS (SMB1, ie vers=1.0) > +have much weaker security. Use of CIFS (SMB1) can be disabled by > +modprobe cifs disable_legacy_dialects=y. > > **** > BUGS > @@ -913,8 +935,8 @@ bugs (minimum: mount.cifs (try ``mount.cifs -V``), kernel (see > VERSION > ******* > > -This man page is correct for version 1.74 of the cifs vfs filesystem > -(roughly Linux kernel 3.0). > +This man page is correct for version 2.18 of the cifs vfs filesystem > +(roughly Linux kernel 5.0). > > ******** > SEE ALSO > -- > 2.7.4 > > From 7047e57bcb343ad867728fbddc5a4da29d7ae9fc Mon Sep 17 00:00:00 2001 > From: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx> > Date: Thu, 4 Apr 2019 16:25:30 +0000 > Subject: [PATCH 7/7] mount.cifs.rst: mention kernel version for snapshots > > Signed-off-by: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx> > --- > mount.cifs.rst | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mount.cifs.rst b/mount.cifs.rst > index 8ba6e7b..02016e0 100644 > --- a/mount.cifs.rst > +++ b/mount.cifs.rst > @@ -398,7 +398,8 @@ snapshot=time > Mount a specific snapshot of the remote share. ``time`` must be a > positive integer identifying the snapshot requested (in 100-nanosecond > units that have elapsed since January 1, 1601, or alternatively it can > - be specified in GMT format e.g. @GMT-2019.03.27-20.52.19) > + be specified in GMT format e.g. @GMT-2019.03.27-20.52.19). Supported > + in the Linux kernel starting from v4.19. > > nobrl > Do not send byte range lock requests to the server. This is necessary > -- > 2.7.4
Attachment:
signature.asc
Description: PGP signature