cifs: store a pointer to the root dentry in cifs_sb_info once we have completed mount...
[sfrench/cifs-2.6.git] / fs / cifs / cifsfs.c
index 8dc2306c9092a507c26d58c62b541d4b13c51f7e..cf8eceb1d5a53056b8f93f437579309a57891d00 100644 (file)
@@ -257,6 +257,12 @@ out_no_root:
 static void cifs_kill_sb(struct super_block *sb)
 {
        struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
+
+       if (cifs_sb->root) {
+               dput(cifs_sb->root);
+               cifs_sb->root = NULL;
+       }
+
        kill_anon_super(sb);
        cifs_umount(cifs_sb);
 }
@@ -886,6 +892,9 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
        if (IS_ERR(root))
                goto out_super;
 
+       if (cifs_sb)
+               cifs_sb->root = dget(root);
+
        cifs_dbg(FYI, "dentry root is: %p\n", root);
        return root;