diff options
author | Joel Becker <jlbec@evilplan.org> | 2011-02-22 01:09:49 -0800 |
---|---|---|
committer | Joel Becker <jlbec@evilplan.org> | 2011-05-18 03:30:58 -0700 |
commit | df7f99670a4c76f269ae57ce91876b309417a316 (patch) | |
tree | 5af5b63ab22089f32f1f464035df061bc2955e8e /fs | |
parent | df016c665b10ae80d8db67ec8103b50c5c234e5c (diff) |
configfs: Don't try to d_delete() negative dentries.
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 <jlbec@evilplan.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/configfs/dir.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 3313dd19f543..b11d7342eef2 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -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); } } @@ -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); |