• Tejun Heo's avatar
    sysfs: use iget_locked() instead of new_inode() · 8312a8d7
    Tejun Heo authored
    After dentry is reclaimed, sysfs always used to allocate new dentry
    and inode if the file is accessed again.  This causes problem with
    operations which only pin the inode.  For example, if inotify watch is
    added to a sysfs file and the dentry for the file is reclaimed, the
    next update event creates new dentry and new inode making the inotify
    watch miss all the events from there on.
    
    This patch fixes it by using iget_locked() instead of new_inode().
    sysfs_new_inode() is renamed to sysfs_get_inode() and inode is
    initialized iff the inode is newly allocated.  sysfs_instantiate() is
    responsible for unlocking new inodes.
    Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    8312a8d7
sysfs.h 5.39 KB