From: Arjan van de Ven <arjanv@redhat.com>

If someone removes a /proc directory which still has subdirectories it will
lead to very nasty things (dentries remaining on hash chains etc etc etc). 
The BUG_ON in the patch below will catch this nasty situation.


---

 fs/proc/generic.c |    1 +
 1 files changed, 1 insertion(+)

diff -puN fs/proc/generic.c~procfs-dangling-subdir-fix fs/proc/generic.c
--- 25/fs/proc/generic.c~procfs-dangling-subdir-fix	2004-03-06 12:32:02.000000000 -0800
+++ 25-akpm/fs/proc/generic.c	2004-03-06 12:32:02.000000000 -0800
@@ -661,6 +661,7 @@ void remove_proc_entry(const char *name,
 			  proc_alloc_map);
 		proc_kill_inodes(de);
 		de->nlink = 0;
+		WARN_ON(de->subdir);
 		if (!atomic_read(&de->count))
 			free_proc_entry(de);
 		else {

_