From: Christoph Hellwig <hch@lst.de>

This can't happen with a sane filesystem (but is triggered by the buggy
clearcase bin only kernel module), so let's better BUG_ON early.

Adopted from Al's patch in the RH tree.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/namei.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)

diff -puN fs/namei.c~bug-on-inconsistant-dcache-tree-in-may_delete fs/namei.c
--- 25/fs/namei.c~bug-on-inconsistant-dcache-tree-in-may_delete	2004-08-15 15:44:03.452667368 -0700
+++ 25-akpm/fs/namei.c	2004-08-15 15:44:03.457666608 -0700
@@ -1094,8 +1094,12 @@ static inline int check_sticky(struct in
 static inline int may_delete(struct inode *dir,struct dentry *victim,int isdir)
 {
 	int error;
-	if (!victim->d_inode || victim->d_parent->d_inode != dir)
+
+	if (!victim->d_inode)
 		return -ENOENT;
+
+	BUG_ON(victim->d_parent->d_inode != dir);
+
 	error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
 	if (error)
 		return error;
_