sysfs: fix hardlink count on device_move
PATCH 1/1 sysfs: fix hardlink count on device_move
From: Peter Oberparleiter <[email protected]>
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:
Quoted 6 lines
ls -laF
/sys/devices/css0/defunct/
total 0drwxr-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
--- fs/sysfs/dir.c | 2 ++ 1 file changed, 2 insertions(+)
fs/sysfs/dir.c +2 -0
@@ -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:
Quoted 6 lines · Peter Oberparleiter
From: Peter Oberparleiter <[email protected]>
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:
Quoted 8 lines
Quoted 6 lines
ls -laF
/sys/devices/css0/defunct/
total 0drwxr-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 <[email protected]>
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
Quoted 13 lines · Greg KH
Quoted 12 lines · Peter Oberparleiter
From: Peter Oberparleiter <[email protected]>
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:
Quoted 6 lines
ls -laF
/sys/devices/css0/defunct/
total 0drwxr-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
Quoted 6 lines
Quoted 1 line
Signed-off-by Peter Oberparleiter <[email protected]>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.
Quoted 16 lines · Peter Oberparleiter
Quoted 15 lines · Greg KH
Quoted 13 lines · Peter Oberparleiter
From: Peter Oberparleiter <[email protected]>
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:
Quoted 6 lines
ls -laF
/sys/devices/css0/defunct/
total 0drwxr-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 <[email protected]>
Quoted 7 lines
Quoted 4 lines
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