Merge tag '5.4-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
[sfrench/cifs-2.6.git] / fs / cifs / cifsfs.c
index e8afff702bb8e60bba9c43fbc593fd6f9e0a1b74..2e9c7f493f99ad649c659e2460d9e6ae4654cb66 100644 (file)
@@ -118,6 +118,7 @@ extern mempool_t *cifs_req_poolp;
 extern mempool_t *cifs_mid_poolp;
 
 struct workqueue_struct        *cifsiod_wq;
+struct workqueue_struct        *decrypt_wq;
 struct workqueue_struct        *cifsoplockd_wq;
 __u32 cifs_lock_secret;
 
@@ -422,6 +423,10 @@ cifs_show_cache_flavor(struct seq_file *s, struct cifs_sb_info *cifs_sb)
                seq_puts(s, "strict");
        else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
                seq_puts(s, "none");
+       else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RW_CACHE)
+               seq_puts(s, "singleclient"); /* assume only one client access */
+       else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RO_CACHE)
+               seq_puts(s, "ro"); /* read only caching assumed */
        else
                seq_puts(s, "loose");
 }
@@ -455,6 +460,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
        cifs_show_security(s, tcon->ses);
        cifs_show_cache_flavor(s, cifs_sb);
 
+       if (tcon->no_lease)
+               seq_puts(s, ",nolease");
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)
                seq_puts(s, ",multiuser");
        else if (tcon->ses->user_name)
@@ -576,6 +583,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
        seq_printf(s, ",rsize=%u", cifs_sb->rsize);
        seq_printf(s, ",wsize=%u", cifs_sb->wsize);
        seq_printf(s, ",bsize=%u", cifs_sb->bsize);
+       if (tcon->ses->server->min_offload)
+               seq_printf(s, ",esize=%u", tcon->ses->server->min_offload);
        seq_printf(s, ",echo_interval=%lu",
                        tcon->ses->server->echo_interval / HZ);
 
@@ -1517,11 +1526,25 @@ init_cifs(void)
                goto out_clean_proc;
        }
 
+       /*
+        * Consider in future setting limit!=0 maybe to min(num_of_cores - 1, 3)
+        * so that we don't launch too many worker threads but
+        * Documentation/workqueue.txt recommends setting it to 0
+        */
+
+       /* WQ_UNBOUND allows decrypt tasks to run on any CPU */
+       decrypt_wq = alloc_workqueue("smb3decryptd",
+                                    WQ_UNBOUND|WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
+       if (!decrypt_wq) {
+               rc = -ENOMEM;
+               goto out_destroy_cifsiod_wq;
+       }
+
        cifsoplockd_wq = alloc_workqueue("cifsoplockd",
                                         WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
        if (!cifsoplockd_wq) {
                rc = -ENOMEM;
-               goto out_destroy_cifsiod_wq;
+               goto out_destroy_decrypt_wq;
        }
 
        rc = cifs_fscache_register();
@@ -1587,6 +1610,8 @@ out_unreg_fscache:
        cifs_fscache_unregister();
 out_destroy_cifsoplockd_wq:
        destroy_workqueue(cifsoplockd_wq);
+out_destroy_decrypt_wq:
+       destroy_workqueue(decrypt_wq);
 out_destroy_cifsiod_wq:
        destroy_workqueue(cifsiod_wq);
 out_clean_proc:
@@ -1613,6 +1638,7 @@ exit_cifs(void)
        cifs_destroy_inodecache();
        cifs_fscache_unregister();
        destroy_workqueue(cifsoplockd_wq);
+       destroy_workqueue(decrypt_wq);
        destroy_workqueue(cifsiod_wq);
        cifs_proc_clean();
 }