From: Tejun Heo <htejun@gmail.com>
To: gregkh@suse.de, dmitry.torokhov@gmail.com,
cornelia.huck@de.ibm.com, oneukum@suse.de, rpurdie@rpsys.net,
stern@rowland.harvard.edu, maneesh@in.ibm.com,
linux-kernel@vger.kernel.org, htejun@gmail.com
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 2/5] sysfs: fix parent refcounting during rename and move
Date: Tue, 29 May 2007 01:10:25 +0900 [thread overview]
Message-ID: <11803686253382-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <1180368625600-git-send-email-htejun@gmail.com>
Parent reference wasn't properly transferred during rename and move.
Fix it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
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 a63d12e..a26e3db 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -497,6 +497,9 @@ int sysfs_rename_dir(struct kobject * ko
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:
--
1.4.3.4
next prev parent reply other threads:[~2007-05-28 16:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-28 16:10 [PATCHSET 2.6.22-rc2-mm1] sysfs: assorted fixes Tejun Heo
2007-05-28 16:10 ` [PATCH 1/5] sysfs: make sysfs_alloc_ino() static Tejun Heo
2007-05-28 16:10 ` Tejun Heo [this message]
2007-05-28 16:10 ` [PATCH 4/5] sysfs: use iget_locked() instead of new_inode() Tejun Heo
2007-05-28 16:10 ` [PATCH 3/5] sysfs: reorganize sysfs_new_indoe() and sysfs_create() Tejun Heo
2007-05-28 16:10 ` [PATCH 5/5] sysfs: fix root sysfs_dirent -> root dentry association Tejun Heo
2007-05-29 14:02 ` [PATCHSET 2.6.22-rc2-mm1] sysfs: assorted fixes Cornelia Huck
2007-05-29 15:58 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11803686253382-git-send-email-htejun@gmail.com \
--to=htejun@gmail.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=maneesh@in.ibm.com \
--cc=oneukum@suse.de \
--cc=rpurdie@rpsys.net \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox