From: Maneesh Soni - d_invalidate() can incorrectly return success instead of returning -EBUSY as we can have situations where lockless d_lookup has found a dentry successfully before d_invalidate drops it fs/dcache.c | 3 +++ 1 files changed, 3 insertions(+) diff -puN fs/dcache.c~d_invalidate-fix fs/dcache.c --- 25/fs/dcache.c~d_invalidate-fix 2003-06-19 09:53:18.000000000 -0700 +++ 25-akpm/fs/dcache.c 2003-06-19 09:53:18.000000000 -0700 @@ -232,14 +232,17 @@ int d_invalidate(struct dentry * dentry) * we might still populate it if it was a * working directory or similar). */ + spin_lock(&dentry->d_lock); if (atomic_read(&dentry->d_count) > 1) { if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) { + spin_unlock(&dentry->d_lock); spin_unlock(&dcache_lock); return -EBUSY; } } __d_drop(dentry); + spin_unlock(&dentry->d_lock); spin_unlock(&dcache_lock); return 0; } _