diff options
| author | Jan Blunck <j.blunck@tu-harburg.de> | 2005-03-07 17:48:44 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-03-07 17:48:44 -0800 |
| commit | cd67725a0cede85ca80348333efdd7063e3ebfb7 (patch) | |
| tree | b6a0ddb8df3bb31a58bcdd375aa8beab95c553f4 /include | |
| parent | 02721572728cccd31b54d69e1dfb8124fa02407e (diff) | |
[PATCH] d_drop should use per dentry lock
d_drop() must use the dentry->d_lock spinlock. In some cases __d_drop()
was used without holding the dentry->d_lock spinlock, too. This could end
in a race with __d_lookup().
Signed-off-by: Jan Blunck <j.blunck@tu-harburg.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/dcache.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 2da76867183c..50be290d24d2 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -162,17 +162,16 @@ extern spinlock_t dcache_lock; * d_drop - drop a dentry * @dentry: dentry to drop * - * d_drop() unhashes the entry from the parent - * dentry hashes, so that it won't be found through - * a VFS lookup any more. Note that this is different - * from deleting the dentry - d_delete will try to - * mark the dentry negative if possible, giving a - * successful _negative_ lookup, while d_drop will + * d_drop() unhashes the entry from the parent dentry hashes, so that it won't + * be found through a VFS lookup any more. Note that this is different from + * deleting the dentry - d_delete will try to mark the dentry negative if + * possible, giving a successful _negative_ lookup, while d_drop will * just make the cache lookup fail. * - * d_drop() is used mainly for stuff that wants - * to invalidate a dentry for some reason (NFS - * timeouts or autofs deletes). + * d_drop() is used mainly for stuff that wants to invalidate a dentry for some + * reason (NFS timeouts or autofs deletes). + * + * __d_drop requires dentry->d_lock. */ static inline void __d_drop(struct dentry *dentry) @@ -186,7 +185,9 @@ static inline void __d_drop(struct dentry *dentry) static inline void d_drop(struct dentry *dentry) { spin_lock(&dcache_lock); + spin_lock(&dentry->d_lock); __d_drop(dentry); + spin_unlock(&dentry->d_lock); spin_unlock(&dcache_lock); } |
