Skip to contentSkip to conversation

BUG() on inconsistant dcache tree in may_delete

PATCH New Christoph Hellwig 1 participant 1 message Aug 14, 2004 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BUG() on inconsistant dcache tree in may_delete

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.

fs/namei.c +5 -1
@@ -1094,8 +1094,12 @@
 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;