Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / fs / autofs4 / inode.c
index 5f6190d..fde78b1 100644 (file)
@@ -95,7 +95,7 @@ void autofs4_free_ino(struct autofs_info *ino)
  */
 static void autofs4_force_release(struct autofs_sb_info *sbi)
 {
-       struct dentry *this_parent = sbi->sb->s_root;
+       struct dentry *this_parent = sbi->root;
        struct list_head *next;
 
        spin_lock(&dcache_lock);
@@ -126,7 +126,7 @@ resume:
                spin_lock(&dcache_lock);
        }
 
-       if (this_parent != sbi->sb->s_root) {
+       if (this_parent != sbi->root) {
                struct dentry *dentry = this_parent;
 
                next = this_parent->d_u.d_child.next;
@@ -139,9 +139,15 @@ resume:
                goto resume;
        }
        spin_unlock(&dcache_lock);
+
+       dput(sbi->root);
+       sbi->root = NULL;
+       shrink_dcache_sb(sbi->sb);
+
+       return;
 }
 
-void autofs4_kill_sb(struct super_block *sb)
+static void autofs4_put_super(struct super_block *sb)
 {
        struct autofs_sb_info *sbi = autofs4_sbi(sb);
 
@@ -156,7 +162,6 @@ void autofs4_kill_sb(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)
@@ -183,6 +188,7 @@ 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,
 };
@@ -308,6 +314,7 @@ 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;
@@ -388,6 +395,13 @@ 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.
         */
@@ -432,6 +446,7 @@ struct inode *autofs4_get_inode(struct super_block *sb,
                inode->i_uid = 0;
                inode->i_gid = 0;
        }
+       inode->i_blksize = PAGE_CACHE_SIZE;
        inode->i_blocks = 0;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;