Index: linux-2.6/fs/dcache.c =================================================================== --- linux-2.6.orig/fs/dcache.c +++ linux-2.6/fs/dcache.c @@ -1177,6 +1177,9 @@ void d_delete(struct dentry * dentry) spin_lock(&dentry->d_lock); isdir = S_ISDIR(dentry->d_inode->i_mode); if (atomic_read(&dentry->d_count) == 1) { + /* remove this and other inotify debug checks after 2.6.18 */ + dentry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED; + dentry_iput(dentry); fsnotify_nameremove(dentry, isdir); return; Index: linux-2.6/fs/inotify.c =================================================================== --- linux-2.6.orig/fs/inotify.c +++ linux-2.6/fs/inotify.c @@ -390,6 +390,7 @@ static inline int inotify_inode_watched( /* * Get child dentry flag into synch with parent inode. + * Flag should always be clear for negative dentrys. */ static void set_dentry_child_flags(struct inode *inode, int watched) { @@ -400,6 +401,10 @@ static void set_dentry_child_flags(struc struct dentry *child; list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) { + if (!child->d_inode) { + WARN_ON(child->d_flags & DCACHE_INOTIFY_PARENT_WATCHED); + continue; + } spin_lock(&child->d_lock); if (watched) { WARN_ON(child->d_flags & DCACHE_INOTIFY_PARENT_WATCHED);