]> err.no Git - linux-2.6/commitdiff
[PATCH] AUTOFS: Make sure all dentries refs are released before calling kill_anon_super()
authorDavid Howells <dhowells@redhat.com>
Wed, 11 Oct 2006 08:22:15 +0000 (01:22 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 11 Oct 2006 18:14:25 +0000 (11:14 -0700)
Make sure all dentries refs are released before calling kill_anon_super() so
that the assumption that generic_shutdown_super() can completely destroy the
dentry tree for there will be no external references holds true.

What was being done in the put_super() superblock op, is now done in the
kill_sb() filesystem op instead, prior to calling kill_anon_super().

This makes the struct autofs_sb_info::root member variable redundant (since
sb->s_root is still available), and so that is removed.  The calls to
shrink_dcache_sb() are also removed since they're also redundant as
shrink_dcache_for_umount() will now be called after the cleanup routine.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Ian Kent <raven@themaw.net>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/autofs4/autofs_i.h
fs/autofs4/init.c
fs/autofs4/inode.c
fs/autofs4/waitq.c

index 480ab178cba50eca22e35bb3af4d0709c0d37258..b13f32c8aeeea26914163e35e7b45a9782e779eb 100644 (file)
@@ -94,7 +94,6 @@ struct autofs_wait_queue {
 
 struct autofs_sb_info {
        u32 magic;
-       struct dentry *root;
        int pipefd;
        struct file *pipe;
        pid_t oz_pgrp;
@@ -229,4 +228,4 @@ out:
 }
 
 void autofs4_dentry_release(struct dentry *);
-
+extern void autofs4_kill_sb(struct super_block *);
index 5d9193332bef1b9eac190d80fb0fa5f97ff28f8a..723a1c5e361b2786c8f8ec97e9332b77b1484e15 100644 (file)
@@ -24,7 +24,7 @@ static struct file_system_type autofs_fs_type = {
        .owner          = THIS_MODULE,
        .name           = "autofs",
        .get_sb         = autofs_get_sb,
-       .kill_sb        = kill_anon_super,
+       .kill_sb        = autofs4_kill_sb,
 };
 
 static int __init init_autofs4_fs(void)
index 800ce876caeca6e33fc427e40d34d89a69923ed3..51fd8595bf85197d252ce3414b73539dd0b9eae8 100644 (file)
@@ -96,7 +96,7 @@ 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;
 
        spin_lock(&dcache_lock);
@@ -127,7 +127,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,15 +140,9 @@ 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);
 
@@ -163,6 +157,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 +184,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,7 +309,6 @@ 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->exp_timeout = 0;
@@ -396,13 +389,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
        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);
-
        /*
         * Success! Install the root dentry now to indicate completion.
         */
index ce103e7b0bc360f684a2556c55ea9ed8be0e38f2..c0a6c8d445c7b7cffc8a7c5163bd32d7ba6bdbd7 100644 (file)
@@ -45,7 +45,6 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi)
                fput(sbi->pipe);        /* Close the pipe */
                sbi->pipe = NULL;
        }
-       shrink_dcache_sb(sbi->sb);
 }
 
 static int autofs4_write(struct file *file, const void *addr, int bytes)