summaryrefslogtreecommitdiffstats
path: root/fs/autofs4/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/autofs4/inode.c')
-rw-r--r--fs/autofs4/inode.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 800ce876caec..ce7c0f1dd529 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -96,9 +96,12 @@ void autofs4_free_ino(struct autofs_info *ino)
*/
static void autofs4_force_release(struct autofs_sb_info *sbi)
{
- struct dentry *this_parent = sbi->root;
+ struct dentry *this_parent = sbi->sb->s_root;
struct list_head *next;
+ if (!sbi->sb->s_root)
+ return;
+
spin_lock(&dcache_lock);
repeat:
next = this_parent->d_subdirs.next;
@@ -127,7 +130,7 @@ resume:
spin_lock(&dcache_lock);
}
- if (this_parent != sbi->root) {
+ if (this_parent != sbi->sb->s_root) {
struct dentry *dentry = this_parent;
next = this_parent->d_u.d_child.next;
@@ -140,18 +143,20 @@ resume:
goto resume;
}
spin_unlock(&dcache_lock);
-
- dput(sbi->root);
- sbi->root = NULL;
- shrink_dcache_sb(sbi->sb);
-
- return;
}
-static void autofs4_put_super(struct super_block *sb)
+void autofs4_kill_sb(struct super_block *sb)
{
struct autofs_sb_info *sbi = autofs4_sbi(sb);
+ /*
+ * In the event of a failure in get_sb_nodev the superblock
+ * info is not present so nothing else has been setup, so
+ * just exit when we are called from deactivate_super.
+ */
+ if (!sbi)
+ return;
+
sb->s_fs_info = NULL;
if ( !sbi->catatonic )
@@ -163,6 +168,7 @@ static void autofs4_put_super(struct super_block *sb)
kfree(sbi);
DPRINTK("shutting down");
+ kill_anon_super(sb);
}
static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt)
@@ -189,7 +195,6 @@ static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt)
}
static struct super_operations autofs4_sops = {
- .put_super = autofs4_put_super,
.statfs = simple_statfs,
.show_options = autofs4_show_options,
};
@@ -315,9 +320,9 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
s->s_fs_info = sbi;
sbi->magic = AUTOFS_SBI_MAGIC;
- sbi->root = NULL;
sbi->pipefd = -1;
- sbi->catatonic = 0;
+ sbi->pipe = NULL;
+ sbi->catatonic = 1;
sbi->exp_timeout = 0;
sbi->oz_pgrp = process_group(current);
sbi->sb = s;
@@ -395,13 +400,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
goto fail_fput;
sbi->pipe = pipe;
sbi->pipefd = pipefd;
-
- /*
- * Take a reference to the root dentry so we get a chance to
- * clean up the dentry tree on umount.
- * See autofs4_force_release.
- */
- sbi->root = dget(root);
+ sbi->catatonic = 0;
/*
* Success! Install the root dentry now to indicate completion.
@@ -426,6 +425,8 @@ fail_ino:
kfree(ino);
fail_free:
kfree(sbi);
+ s->s_fs_info = NULL;
+ kill_anon_super(s);
fail_unlock:
return -EINVAL;
}