From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>,
stable <stable@kernel.org>, Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 1/5] sysfs: fix hardlink count on device_move
Date: Tue, 28 Jul 2009 14:44:37 -0700 [thread overview]
Message-ID: <1248817481-13372-1-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20090728213826.GC13090@kroah.com>
From: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Update directory hardlink count when moving kobjects to a new parent.
Fixes the following problem which occurs when several devices are
moved to the same parent and then unregistered:
> ls -laF /sys/devices/css0/defunct/
> total 0
> drwxr-xr-x 4294967295 root root 0 2009-07-14 17:02 ./
> drwxr-xr-x 114 root root 0 2009-07-14 17:02 ../
> drwxr-xr-x 2 root root 0 2009-07-14 17:01 power/
> -rw-r--r-- 1 root root 4096 2009-07-14 17:01 uevent
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/sysfs/dir.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index d88d0fa..14f2d71 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -939,8 +939,10 @@ again:
/* Remove from old parent's list and insert into new parent's list. */
sysfs_unlink_sibling(sd);
sysfs_get(new_parent_sd);
+ drop_nlink(old_parent->d_inode);
sysfs_put(sd->s_parent);
sd->s_parent = new_parent_sd;
+ inc_nlink(new_parent->d_inode);
sysfs_link_sibling(sd);
out_unlock:
--
1.6.3.2
next prev parent reply other threads:[~2009-07-28 21:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-28 21:38 [GIT PATCH] driver core patches for 2.6.31-rc4-git Greg KH
2009-07-28 21:44 ` Greg Kroah-Hartman [this message]
2009-07-28 21:44 ` [PATCH 2/5] driver core: firmware_class:fix memory leak of page pointers array Greg Kroah-Hartman
2009-07-28 21:44 ` [PATCH 3/5] Dynamic debug: fix typo: -/-> Greg Kroah-Hartman
2009-07-28 21:44 ` [PATCH 4/5] driver core: sysdev: do not send KOBJ_ADD uevent if kobject_init_and_add fails Greg Kroah-Hartman
2009-07-28 21:44 ` [PATCH 5/5] driver core: documentation: make it clear that sysfs is optional Greg Kroah-Hartman
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=1248817481-13372-1-git-send-email-gregkh@suse.de \
--to=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=oberpar@linux.vnet.ibm.com \
--cc=stable@kernel.org \
/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