]> git.hungrycats.org Git - linux/commit
[PATCH] fix-sysfs-symlinks.patch
authorManeesh Soni <maneesh@in.ibm.com>
Mon, 17 May 2004 03:32:30 +0000 (20:32 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 17 May 2004 03:32:30 +0000 (20:32 -0700)
commit377912145f05c9dae40b8e6a46824fe1012e0b73
tree7e88f584986caeb877e6ebe68156fc30b6a19dad
parentbd7b6c43e2e61a6380c1a1b99229d108c16c1f3a
[PATCH] fix-sysfs-symlinks.patch

- Rediffed the patch for 2.6.6-mm3 to fix rejects in the latest changes
  in sysfs code.

o The symlinks code in sysfs doesnot point to the correct target kobject
  whenever target kobject is renamed and suffers from dangling symlinks
  if target kobject is removed.

o The following patch implements ->readlink and ->follow_link operations
  for sysfs instead of using the page_symlink_inode_operations.
  The pointer to target kobject is saved in the link dentry's d_fsdata field.
  The target path is generated everytime we do ->readlink and ->follow_link.
  This results in generating the correct target path during readlink and
  follow_link operations inspite of renamed target kobject.

o This also pins the target kobject during link creation and the ref. is
  released when the link is removed.

o Apart from being correct this patch also saves some memory by not pinning
  a whole page for saving the target information.

o Used a rw_semaphor sysfs_rename_sem to avoid clashing with renaming of
  ancestors while the target path is generated.

o Used dcache_lock in fs/sysfs/sysfs.h:sysfs_get_kobject() because of using
  d_drop() while removing dentries.
fs/sysfs/dir.c
fs/sysfs/inode.c
fs/sysfs/symlink.c
fs/sysfs/sysfs.h