]> git.hungrycats.org Git - linux/commit
[PATCH] Check for zero d_count in dget()
authorAndrew Morton <akpm@digeo.com>
Tue, 25 Feb 2003 01:06:20 +0000 (17:06 -0800)
committerJeff Garzik <jgarzik@redhat.com>
Tue, 25 Feb 2003 01:06:20 +0000 (17:06 -0800)
commit3e38f30e4631ba4ea1382eb72ee6887f06848352
tree26ba0e9acc42cea9dbb89c70f30a07f596eba37c
parentb7013f4c94e3ed23e86ebf8e2fa4e65d66ecfe89
[PATCH] Check for zero d_count in dget()

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().
fs/dcache.c
include/linux/dcache.h