UPSTREAM: of/pci: Add helper function to parse max-link-speed from dt
[firefly-linux-kernel-4.4.55.git] / fs / cifs / cifsfs.c
index e739950ca08485543db80bee53f1021384ed0b9a..4f4fc9ff36365faf5826049e3179a8c1d9eed37c 100644 (file)
 #endif
 
 int cifsFYI = 0;
-int traceSMB = 0;
+bool traceSMB;
 bool enable_oplocks = true;
-unsigned int linuxExtEnabled = 1;
-unsigned int lookupCacheEnabled = 1;
+bool linuxExtEnabled = true;
+bool lookupCacheEnabled = true;
 unsigned int global_secflags = CIFSSEC_DEF;
 /* unsigned int ntlmv2_support = 0; */
 unsigned int sign_CIFS_PDUs = 1;
@@ -268,7 +268,7 @@ cifs_alloc_inode(struct super_block *sb)
        cifs_inode->createtime = 0;
        cifs_inode->epoch = 0;
 #ifdef CONFIG_CIFS_SMB2
-       get_random_bytes(cifs_inode->lease_key, SMB2_LEASE_KEY_SIZE);
+       generate_random_uuid(cifs_inode->lease_key);
 #endif
        /*
         * Can not set i_flags here - they get immediately overwritten to zero
@@ -454,6 +454,10 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
                seq_puts(s, ",nocase");
        if (tcon->retry)
                seq_puts(s, ",hard");
+       if (tcon->use_persistent)
+               seq_puts(s, ",persistenthandles");
+       else if (tcon->use_resilient)
+               seq_puts(s, ",resilienthandles");
        if (tcon->unix_ext)
                seq_puts(s, ",unix");
        else
@@ -682,6 +686,14 @@ cifs_do_mount(struct file_system_type *fs_type,
                goto out_cifs_sb;
        }
 
+       if (volume_info->prepath) {
+               cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL);
+               if (cifs_sb->prepath == NULL) {
+                       root = ERR_PTR(-ENOMEM);
+                       goto out_cifs_sb;
+               }
+       }
+
        cifs_setup_cifs_sb(volume_info, cifs_sb);
 
        rc = cifs_mount(cifs_sb, volume_info);
@@ -720,7 +732,11 @@ cifs_do_mount(struct file_system_type *fs_type,
                sb->s_flags |= MS_ACTIVE;
        }
 
-       root = cifs_get_root(volume_info, sb);
+       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)
+               root = dget(sb->s_root);
+       else
+               root = cifs_get_root(volume_info, sb);
+
        if (IS_ERR(root))
                goto out_super;
 
@@ -921,9 +937,7 @@ const struct file_operations cifs_file_ops = {
        .mmap  = cifs_file_mmap,
        .splice_read = generic_file_splice_read,
        .llseek = cifs_llseek,
-#ifdef CONFIG_CIFS_POSIX
        .unlocked_ioctl = cifs_ioctl,
-#endif /* CONFIG_CIFS_POSIX */
        .setlease = cifs_setlease,
        .fallocate = cifs_fallocate,
 };
@@ -939,9 +953,7 @@ const struct file_operations cifs_file_strict_ops = {
        .mmap = cifs_file_strict_mmap,
        .splice_read = generic_file_splice_read,
        .llseek = cifs_llseek,
-#ifdef CONFIG_CIFS_POSIX
        .unlocked_ioctl = cifs_ioctl,
-#endif /* CONFIG_CIFS_POSIX */
        .setlease = cifs_setlease,
        .fallocate = cifs_fallocate,
 };
@@ -957,9 +969,7 @@ const struct file_operations cifs_file_direct_ops = {
        .flush = cifs_flush,
        .mmap = cifs_file_mmap,
        .splice_read = generic_file_splice_read,
-#ifdef CONFIG_CIFS_POSIX
        .unlocked_ioctl  = cifs_ioctl,
-#endif /* CONFIG_CIFS_POSIX */
        .llseek = cifs_llseek,
        .setlease = cifs_setlease,
        .fallocate = cifs_fallocate,
@@ -975,9 +985,7 @@ const struct file_operations cifs_file_nobrl_ops = {
        .mmap  = cifs_file_mmap,
        .splice_read = generic_file_splice_read,
        .llseek = cifs_llseek,
-#ifdef CONFIG_CIFS_POSIX
        .unlocked_ioctl = cifs_ioctl,
-#endif /* CONFIG_CIFS_POSIX */
        .setlease = cifs_setlease,
        .fallocate = cifs_fallocate,
 };
@@ -992,9 +1000,7 @@ const struct file_operations cifs_file_strict_nobrl_ops = {
        .mmap = cifs_file_strict_mmap,
        .splice_read = generic_file_splice_read,
        .llseek = cifs_llseek,
-#ifdef CONFIG_CIFS_POSIX
        .unlocked_ioctl = cifs_ioctl,
-#endif /* CONFIG_CIFS_POSIX */
        .setlease = cifs_setlease,
        .fallocate = cifs_fallocate,
 };
@@ -1009,9 +1015,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = {
        .flush = cifs_flush,
        .mmap = cifs_file_mmap,
        .splice_read = generic_file_splice_read,
-#ifdef CONFIG_CIFS_POSIX
        .unlocked_ioctl  = cifs_ioctl,
-#endif /* CONFIG_CIFS_POSIX */
        .llseek = cifs_llseek,
        .setlease = cifs_setlease,
        .fallocate = cifs_fallocate,
@@ -1206,7 +1210,6 @@ init_cifs(void)
        GlobalTotalActiveXid = 0;
        GlobalMaxActiveXid = 0;
        spin_lock_init(&cifs_tcp_ses_lock);
-       spin_lock_init(&cifs_file_list_lock);
        spin_lock_init(&GlobalMid_Lock);
 
        if (cifs_max_pending < 2) {