public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sysfs: fix hardlink count on device_move
@ 2009-07-14 15:56 Peter Oberparleiter
  2009-07-14 16:04 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Oberparleiter @ 2009-07-14 15:56 UTC (permalink / raw)
  To: gregkh; +Cc: Linux Kernel Mailing List

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>
---
 fs/sysfs/dir.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6.31-rc3/fs/sysfs/dir.c
===================================================================
--- linux-2.6.31-rc3.orig/fs/sysfs/dir.c
+++ linux-2.6.31-rc3/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:


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sysfs: fix hardlink count on device_move
  2009-07-14 15:56 [PATCH] sysfs: fix hardlink count on device_move Peter Oberparleiter
@ 2009-07-14 16:04 ` Greg KH
  2009-07-15  9:17   ` Peter Oberparleiter
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2009-07-14 16:04 UTC (permalink / raw)
  To: Peter Oberparleiter; +Cc: Linux Kernel Mailing List

On Tue, Jul 14, 2009 at 05:56:15PM +0200, Peter Oberparleiter wrote:
> 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>

Thanks for the patch.

Is this something new in 2.6.31-rc, or does it also show up in .30
and/or .27?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sysfs: fix hardlink count on device_move
  2009-07-14 16:04 ` Greg KH
@ 2009-07-15  9:17   ` Peter Oberparleiter
  2009-07-15 13:20     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Oberparleiter @ 2009-07-15  9:17 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux Kernel Mailing List

Greg KH wrote:
> On Tue, Jul 14, 2009 at 05:56:15PM +0200, Peter Oberparleiter wrote:
>> 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>
> 
> Thanks for the patch.
> 
> Is this something new in 2.6.31-rc, or does it also show up in .30
> and/or .27?

This is an old problem that existed since the introduction of 
sysfs_move_dir() in 2.6.20.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sysfs: fix hardlink count on device_move
  2009-07-15  9:17   ` Peter Oberparleiter
@ 2009-07-15 13:20     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2009-07-15 13:20 UTC (permalink / raw)
  To: Peter Oberparleiter; +Cc: Linux Kernel Mailing List

On Wed, Jul 15, 2009 at 11:17:43AM +0200, Peter Oberparleiter wrote:
> Greg KH wrote:
> > On Tue, Jul 14, 2009 at 05:56:15PM +0200, Peter Oberparleiter wrote:
> >> 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>
> > 
> > Thanks for the patch.
> > 
> > Is this something new in 2.6.31-rc, or does it also show up in .30
> > and/or .27?
> 
> This is an old problem that existed since the introduction of 
> sysfs_move_dir() in 2.6.20.

Thanks for the info, I'll mark it as such.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-15 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-14 15:56 [PATCH] sysfs: fix hardlink count on device_move Peter Oberparleiter
2009-07-14 16:04 ` Greg KH
2009-07-15  9:17   ` Peter Oberparleiter
2009-07-15 13:20     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox