__unhash_process acquires the dcache_lock while holding the tasklist_lock for writing. This can deadlock. While trying to fix that race, I found further races with proc_dentry. The attached patch (hopefully) fixes all these races. Changes: - fs/proc/base.c assumed that p->pid is reset to 0 during exit. This is not the case anymore. I now look at the count of the pid structure for PIDTYPE_PID. - pid_delete_dentry and pid_revalidate removed. The implementation didn't work, and noone complained. - only d_add the new proc entry if the task is still valid: d_add+d_drop is a race, if a lookup happens between both calls. - add a new spinlock that protects proc_dentry. What do you think? I don't like the new spinlock, but I couldn't find another solution. -- Manfred