[lkml]   [2007]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] Add a refcount check in dput()
Add a BUG_ON() to check for passing an unreferenced dentry to dput().

This is analogous to the similar check in dget(), and will make
reference-counting bugs in filesystems more immediately obvious. (I
just spent a while debugging an oops that turned out to be due to
broken fs reference counting.)

Signed-off-by: Paul Menage <>

fs/dcache.c | 1 +
1 file changed, 1 insertion(+)
Index: container-2.6.23-rc3-mm1/fs/dcache.c
--- container-2.6.23-rc3-mm1.orig/fs/dcache.c
+++ container-2.6.23-rc3-mm1/fs/dcache.c
@@ -176,6 +176,7 @@ void dput(struct dentry *dentry)
if (!dentry)

+ BUG_ON(!atomic_read(&dentry->d_count));
if (atomic_read(&dentry->d_count) == 1)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2007-09-11 00:15    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean