Commit 01ddc4ed authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Al Viro

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: default avatarMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent a09e9a7a
...@@ -2952,6 +2952,10 @@ void d_genocide(struct dentry *root) ...@@ -2952,6 +2952,10 @@ void d_genocide(struct dentry *root)
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
continue; continue;
} }
if (!(dentry->d_flags & DCACHE_GENOCIDE)) {
dentry->d_flags |= DCACHE_GENOCIDE;
dentry->d_lockref.count--;
}
if (!list_empty(&dentry->d_subdirs)) { if (!list_empty(&dentry->d_subdirs)) {
spin_unlock(&this_parent->d_lock); spin_unlock(&this_parent->d_lock);
spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_); spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_);
...@@ -2959,18 +2963,10 @@ void d_genocide(struct dentry *root) ...@@ -2959,18 +2963,10 @@ void d_genocide(struct dentry *root)
spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_); spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_);
goto repeat; goto repeat;
} }
if (!(dentry->d_flags & DCACHE_GENOCIDE)) {
dentry->d_flags |= DCACHE_GENOCIDE;
dentry->d_lockref.count--;
}
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
} }
if (this_parent != root) { if (this_parent != root) {
struct dentry *child = this_parent; 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); this_parent = try_to_ascend(this_parent, locked, seq);
if (!this_parent) if (!this_parent)
goto rename_retry; goto rename_retry;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment