summaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2013-09-05 11:44:34 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2013-09-05 16:22:43 -0400
commit01ddc4ede5f09cdaed015d49ab66eec179085a2e (patch)
tree360acfdd63f30ca9a52d1d46d39d7cbea044c98a /fs/dcache.c
parenta09e9a7a4b907f2dfa9bdb2b98a1828ab4b340b2 (diff)
downloadop-kernel-dev-01ddc4ede5f09cdaed015d49ab66eec179085a2e.zip
op-kernel-dev-01ddc4ede5f09cdaed015d49ab66eec179085a2e.tar.gz
vfs: restructure d_genocide()
It shouldn't matter when we decrement the refcount during the walk as long as we do it exactly once. Restructure d_genocide() to do the killing on entering the dentry instead of when leaving it. This helps creating a common helper for tree walking. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 5aa53bc..f792e9f 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2952,6 +2952,10 @@ resume:
spin_unlock(&dentry->d_lock);
continue;
}
+ if (!(dentry->d_flags & DCACHE_GENOCIDE)) {
+ dentry->d_flags |= DCACHE_GENOCIDE;
+ dentry->d_lockref.count--;
+ }
if (!list_empty(&dentry->d_subdirs)) {
spin_unlock(&this_parent->d_lock);
spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_);
@@ -2959,18 +2963,10 @@ resume:
spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_);
goto repeat;
}
- if (!(dentry->d_flags & DCACHE_GENOCIDE)) {
- dentry->d_flags |= DCACHE_GENOCIDE;
- dentry->d_lockref.count--;
- }
spin_unlock(&dentry->d_lock);
}
if (this_parent != root) {
struct dentry *child = this_parent;
- if (!(this_parent->d_flags & DCACHE_GENOCIDE)) {
- this_parent->d_flags |= DCACHE_GENOCIDE;
- this_parent->d_lockref.count--;
- }
this_parent = try_to_ascend(this_parent, locked, seq);
if (!this_parent)
goto rename_retry;
OpenPOWER on IntegriCloud