aboutsummaryrefslogtreecommitdiffstats
path: root/fs/configfs/dir.c
diff options
context:
space:
mode:
authorJoel Becker <jlbec@evilplan.org>2011-02-22 04:09:49 -0500
committerJoel Becker <jlbec@evilplan.org>2011-05-18 06:30:58 -0400
commitdf7f99670a4c76f269ae57ce91876b309417a316 (patch)
tree5af5b63ab22089f32f1f464035df061bc2955e8e /fs/configfs/dir.c
parentdf016c665b10ae80d8db67ec8103b50c5c234e5c (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/configfs/dir.c')
-rw-r--r--fs/configfs/dir.c6
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,
689 sd = child->d_fsdata; 689 sd = child->d_fsdata;
690 sd->s_type |= CONFIGFS_USET_DEFAULT; 690 sd->s_type |= CONFIGFS_USET_DEFAULT;
691 } else { 691 } else {
692 d_delete(child); 692 BUG_ON(child->d_inode);
693 d_drop(child);
693 dput(child); 694 dput(child);
694 } 695 }
695 } 696 }
@@ -1683,7 +1684,8 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1683 err = configfs_attach_group(sd->s_element, &group->cg_item, 1684 err = configfs_attach_group(sd->s_element, &group->cg_item,
1684 dentry); 1685 dentry);
1685 if (err) { 1686 if (err) {
1686 d_delete(dentry); 1687 BUG_ON(dentry->d_inode);
1688 d_drop(dentry);
1687 dput(dentry); 1689 dput(dentry);
1688 } else { 1690 } else {
1689 spin_lock(&configfs_dirent_lock); 1691 spin_lock(&configfs_dirent_lock);