Merge tag 'driver-core-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[platform/kernel/linux-rpi.git] / fs / cifs / cifsfs.c
index d5aa7ae..7065426 100644 (file)
@@ -139,6 +139,9 @@ cifs_read_super(struct super_block *sb)
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIXACL)
                sb->s_flags |= SB_POSIXACL;
 
+       if (tcon->snapshot_time)
+               sb->s_flags |= SB_RDONLY;
+
        if (tcon->ses->capabilities & tcon->ses->server->vals->cap_large_files)
                sb->s_maxbytes = MAX_LFS_FILESIZE;
        else
@@ -209,14 +212,16 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
 
        xid = get_xid();
 
-       /*
-        * PATH_MAX may be too long - it would presumably be total path,
-        * but note that some servers (includinng Samba 3) have a shorter
-        * maximum path.
-        *
-        * Instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO.
-        */
-       buf->f_namelen = PATH_MAX;
+       if (le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength) > 0)
+               buf->f_namelen =
+                      le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength);
+       else
+               buf->f_namelen = PATH_MAX;
+
+       buf->f_fsid.val[0] = tcon->vol_serial_number;
+       /* are using part of create time for more randomness, see man statfs */
+       buf->f_fsid.val[1] =  (int)le64_to_cpu(tcon->vol_create_time);
+
        buf->f_files = 0;       /* undefined */
        buf->f_ffree = 0;       /* unlimited */
 
@@ -427,7 +432,7 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
        else if (tcon->ses->user_name)
                seq_show_option(s, "username", tcon->ses->user_name);
 
-       if (tcon->ses->domainName)
+       if (tcon->ses->domainName && tcon->ses->domainName[0] != 0)
                seq_show_option(s, "domain", tcon->ses->domainName);
 
        if (srcaddr->sa_family != AF_UNSPEC) {
@@ -481,20 +486,12 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
                seq_puts(s, ",persistenthandles");
        else if (tcon->use_resilient)
                seq_puts(s, ",resilienthandles");
-
-#ifdef CONFIG_CIFS_SMB311
        if (tcon->posix_extensions)
                seq_puts(s, ",posix");
        else if (tcon->unix_ext)
                seq_puts(s, ",unix");
        else
                seq_puts(s, ",nounix");
-#else
-       if (tcon->unix_ext)
-               seq_puts(s, ",unix");
-       else
-               seq_puts(s, ",nounix");
-#endif /* SMB311 */
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
                seq_puts(s, ",posixpaths");
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)
@@ -546,6 +543,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
        seq_printf(s, ",wsize=%u", cifs_sb->wsize);
        seq_printf(s, ",echo_interval=%lu",
                        tcon->ses->server->echo_interval / HZ);
+       if (tcon->snapshot_time)
+               seq_printf(s, ",snapshot=%llu", tcon->snapshot_time);
        /* convert actimeo and display it in seconds */
        seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ);