2.5.recent: device_remove_file() doesn't
I've noticed that recent kernels don't clean up device attribute files correctly when they're removed. Instead, they're left in the directory with a refcount of zero.
That refcount stays even when the file is recreated later; and the contents can be read. Delete them again, and now the refcount is 65535 ... though now reading the contents may cause oopsing.
This worked correctly at some point last month: the file no longer appeared in sysfs after deletion.
Got Patch?
- Dave
Quoted 9 lines · David Brownell
I've noticed that recent kernels don't clean up device attribute files correctly when they're removed. Instead, they're left in the directory with a refcount of zero.
That refcount stays even when the file is recreated later; and the contents can be read. Delete them again, and now the refcount is 65535 ... though now reading the contents may cause oopsing.
Quoted 4 lines
This worked correctly at some point last month: the file no longer appeared in sysfs after deletion.
Got Patch?
Yeah, and I apologize. File deletion has been causing some problems lately due to some bad assumptions of the dentry layer. This patch reverts a small bit of the patch that went in a couple of weeks ago, and should hopefully fix everything up.
This should also take care of the problem that some have been seeing of symlinks not going away on device/module removal (though I've been unable to reproduce those).
Greg/Mike, could you give this patch a shot and let me know if helps?
Thanks,
-pat
===== fs/sysfs/inode.c 1.84 vs edited =====
fs/sysfs/inode.c +1 -1
@@ -97,7 +97,7 @@ atomic_read(&victim->d_count));simple_unlink (dir->d_inode,victim); - +d_delete (victim); }/* * Drop reference from sysfs_get_dentry() above.
Quoted 2 lines · Patrick Mochel
Greg/Mike, could you give this patch a shot and let me know if helps?
Yes, this seems to fix the symlink problem I was seeing before, thanks.
greg k-h
Quoted 6 lines · Greg KH [[email protected]] wrote:
Quoted 2 lines · Patrick Mochel
Greg/Mike, could you give this patch a shot and let me know if helps?
Yes, this seems to fix the symlink problem I was seeing before, thanks.
It has also fixed my symlink issue.
thanks,
-andmike
--
Michael Anderson
[email protected]
Thanks, it resolved that problem.
- Dave
Quoted 13 lines
fs/sysfs/inode.c +1
-1@@ -97,7 +97,7 @@ atomic_read(&victim->d_count));simple_unlink (dir->d_inode,victim); - +d_delete (victim); }/* * Drop reference from sysfs_get_dentry() above.