Skip to content
  • Tejun Heo's avatar
    kernfs: allow negative dentries · 19bbb926
    Tejun Heo authored
    
    
    kernfs doesn't allow negative dentries - kernfs_iop_lookup() returns
    ERR_PTR(-ENOENT) instead of NULL which short-circuits negative dentry
    creation and kernfs's d_delete() callback, kernfs_dop_delete(),
    returns 1 for all removed nodes.  This in turn allows
    kernfs_dop_revalidate() to assume that there's no negative dentry for
    kernfs.
    
    This worked fine for sysfs but kernfs is scheduled to grow mkdir(2)
    support which depend on negative dentries.  This patch updates so that
    kernfs allows negative dentries.  The required changes are almost
    trivial - kernfs_iop_lookup() now returns NULL instead of
    ERR_PTR(-ENOENT) when the target kernfs_node doesn't exist,
    kernfs_dop_delete() is removed and kernfs_dop_revalidate() is updated
    to check whether the target dentry is negative and request fresh
    lookup if so.
    
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    19bbb926