• Maneesh Soni's avatar
    [PATCH] fix-sysfs-symlinks.patch · 37791214
    Maneesh Soni authored
    - 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.
    37791214
inode.c 2.63 KB