diff options
author | Tejun Heo <htejun@gmail.com> | 2007-06-14 03:45:17 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-11 16:09:07 -0700 |
commit | 7f7cfffe60ed6271c4028ec79ae1c297b44bcb14 (patch) | |
tree | b2d0f1228f9b6cc0cc262cd1be6d950ec4816291 /fs/sysfs | |
parent | 42b37df6abb42ae021e15bf865b43f3629c7f3ab (diff) |
sysfs: fix parent refcounting during rename and move
Parent reference wasn't properly transferred during rename and move.
Fix it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/dir.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index a63d12e4be5..a26e3db8943 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -497,6 +497,9 @@ int sysfs_rename_dir(struct kobject * kobj, struct dentry *new_parent, d_move(kobj->dentry, new_dentry); list_del_init(&sd->s_sibling); + sysfs_get(parent_sd); + sysfs_put(sd->s_parent); + sd->s_parent = parent_sd; list_add(&sd->s_sibling, &parent_sd->s_children); error = 0; @@ -550,6 +553,9 @@ again: /* Remove from old parent's list and insert into new parent's list. */ list_del_init(&sd->s_sibling); + sysfs_get(new_parent_sd); + sysfs_put(sd->s_parent); + sd->s_parent = new_parent_sd; list_add(&sd->s_sibling, &new_parent_sd->s_children); out: |