• Andrew Morton's avatar
    [PATCH] Check for zero d_count in dget() · 3e38f30e
    Andrew Morton authored
    Patch from Maneesh Soni <maneesh@in.ibm.com>
    
    Turns out that sysfs is doing dget() on a zero-ref dentry.  That's a bug, but
    dcache is no longer detecting it.
    
    The check was removed because with lockless d_lookup, there can be cases when
    d_lookup and dput are going on concurrently, If d_lookup happens earlier then
    it may do dget() on a dentry for which dput() has decremented the ref count
    to zero.  This race is handled by taking the per dentry lock and checking the
    DCACHE_UNHASHED flag.
    
    The patch open-codes that part of d_lookup(), and restores the BUG check in
    dget().
    3e38f30e
dcache.c 40.3 KB