Commit d788e516 authored by Shyam Prasad N's avatar Shyam Prasad N Committed by Steve French

cifs: release cached dentries only if mount is complete

During cifs_kill_sb, we first dput all the dentries that we have cached.
However this function can also get called for mount failures.
So dput the cached dentries only if the filesystem mount is complete.
i.e. cifs_sb->root is populated.

Fixes: 5e9c89d4 ("cifs: Grab a reference for the dentry of the cached directory during the lifetime of the cache")
Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 994fd530
...@@ -266,9 +266,6 @@ static void cifs_kill_sb(struct super_block *sb) ...@@ -266,9 +266,6 @@ static void cifs_kill_sb(struct super_block *sb)
* before we kill the sb. * before we kill the sb.
*/ */
if (cifs_sb->root) { if (cifs_sb->root) {
dput(cifs_sb->root);
cifs_sb->root = NULL;
}
node = rb_first(root); node = rb_first(root);
while (node != NULL) { while (node != NULL) {
tlink = rb_entry(node, struct tcon_link, tl_rbnode); tlink = rb_entry(node, struct tcon_link, tl_rbnode);
...@@ -283,6 +280,11 @@ static void cifs_kill_sb(struct super_block *sb) ...@@ -283,6 +280,11 @@ static void cifs_kill_sb(struct super_block *sb)
node = rb_next(node); node = rb_next(node);
} }
/* finally release root dentry */
dput(cifs_sb->root);
cifs_sb->root = NULL;
}
kill_anon_super(sb); kill_anon_super(sb);
cifs_umount(cifs_sb); cifs_umount(cifs_sb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment