Skip to content

Commit

Permalink
Use kill_litter_super() in autofs4 ->kill_sb()
Browse files Browse the repository at this point in the history
... and get rid of open-coding its guts (i.e. RIP autofs4_force_release())

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Mar 3, 2010
1 parent 3899167 commit 5b7e934
Showing 1 changed file with 1 addition and 61 deletions.
62 changes: 1 addition & 61 deletions fs/autofs4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,63 +96,6 @@ void autofs4_free_ino(struct autofs_info *ino)
kfree(ino);
}

/*
* Deal with the infamous "Busy inodes after umount ..." message.
*
* Clean up the dentry tree. This happens with autofs if the user
* space program goes away due to a SIGKILL, SIGSEGV etc.
*/
static void autofs4_force_release(struct autofs_sb_info *sbi)
{
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;
resume:
while (next != &this_parent->d_subdirs) {
struct dentry *dentry = list_entry(next, struct dentry, d_u.d_child);

/* Negative dentry - don`t care */
if (!simple_positive(dentry)) {
next = next->next;
continue;
}

if (!list_empty(&dentry->d_subdirs)) {
this_parent = dentry;
goto repeat;
}

next = next->next;
spin_unlock(&dcache_lock);

DPRINTK("dentry %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);

dput(dentry);
spin_lock(&dcache_lock);
}

if (this_parent != sbi->sb->s_root) {
struct dentry *dentry = this_parent;

next = this_parent->d_u.d_child.next;
this_parent = this_parent->d_parent;
spin_unlock(&dcache_lock);
DPRINTK("parent dentry %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);
dput(dentry);
spin_lock(&dcache_lock);
goto resume;
}
spin_unlock(&dcache_lock);
}

void autofs4_kill_sb(struct super_block *sb)
{
struct autofs_sb_info *sbi = autofs4_sbi(sb);
Expand All @@ -169,15 +112,12 @@ void autofs4_kill_sb(struct super_block *sb)
/* Free wait queues, close pipe */
autofs4_catatonic_mode(sbi);

/* Clean up and release dangling references */
autofs4_force_release(sbi);

sb->s_fs_info = NULL;
kfree(sbi);

out_kill_sb:
DPRINTK("shutting down");
kill_anon_super(sb);
kill_litter_super(sb);
}

static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt)
Expand Down

0 comments on commit 5b7e934

Please sign in to comment.