Skip to content

Commit

Permalink
configfs: Don't try to d_delete() negative dentries.
Browse files Browse the repository at this point in the history
When configfs is faking mkdir() on its subsystem or default group
objects, it starts by adding a negative dentry.  It then tries to
instantiate the group.  If that should fail, it must clean up after
itself.

I was using d_delete() here, but configfs_attach_group() promises to
return an empty dentry on error.  d_delete() explodes with the entry
dentry.  Let's try d_drop() instead.  The unhashing is what we want for
our dentry.

Signed-off-by: Joel Becker <[email protected]>
  • Loading branch information
jlbec committed May 18, 2011
1 parent df016c6 commit df7f996
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/configfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ static int create_default_group(struct config_group *parent_group,
sd = child->d_fsdata;
sd->s_type |= CONFIGFS_USET_DEFAULT;
} else {
d_delete(child);
BUG_ON(child->d_inode);
d_drop(child);
dput(child);
}
}
Expand Down Expand Up @@ -1683,7 +1684,8 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
err = configfs_attach_group(sd->s_element, &group->cg_item,
dentry);
if (err) {
d_delete(dentry);
BUG_ON(dentry->d_inode);
d_drop(dentry);
dput(dentry);
} else {
spin_lock(&configfs_dirent_lock);
Expand Down

0 comments on commit df7f996

Please sign in to comment.