Commit 3237b7b8 authored by Paul Menage's avatar Paul Menage Committed by James Toy

Add a WARN_ON_ONCE() 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: default avatarPaul Menage <menage@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 8cec2daf
......@@ -217,6 +217,7 @@ void dput(struct dentry *dentry)
if (!dentry)
return;
WARN_ON_ONCE(!atomic_read(&dentry->d_count));
repeat:
if (atomic_read(&dentry->d_count) == 1)
might_sleep();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment