diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-13 17:13:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-13 17:13:39 -0500 |
commit | f4b3e631b39db31f7375cce0b5e4111d14cde511 (patch) | |
tree | 2dc8a21d0432bad2fe86c5a41cc24f972948025e /fs/kernfs | |
parent | 9b0925a6ff64a33be45497e3c798bfee8790b102 (diff) |
Revert "kernfs: make kernfs_get_active() block if the node is deactivated but not removed"
This reverts commit 895a068a524e134900b9d98b519309b7aae7bbb1.
Tejun writes:
I'm sorry but can you please revert the whole series?
get_active() waiting while a node is deactivated has potential
to lead to deadlock and that deactivate/reactivate interface is
something fundamentally flawed and that cgroup will have to work
with the remove_self() like everybody else. IOW, I think the
first posting was correct.
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs')
-rw-r--r-- | fs/kernfs/dir.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 37dd6408f5f6..770d687ee9f3 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -149,25 +149,12 @@ struct kernfs_node *kernfs_get_active(struct kernfs_node *kn) | |||
149 | if (unlikely(!kn)) | 149 | if (unlikely(!kn)) |
150 | return NULL; | 150 | return NULL; |
151 | 151 | ||
152 | if (kernfs_lockdep(kn)) | 152 | if (!atomic_inc_unless_negative(&kn->active)) |
153 | rwsem_acquire_read(&kn->dep_map, 0, 1, _RET_IP_); | 153 | return NULL; |
154 | |||
155 | /* | ||
156 | * Try to obtain an active ref. If @kn is deactivated, we block | ||
157 | * till either it's reactivated or killed. | ||
158 | */ | ||
159 | do { | ||
160 | if (atomic_inc_unless_negative(&kn->active)) | ||
161 | return kn; | ||
162 | |||
163 | wait_event(kernfs_root(kn)->deactivate_waitq, | ||
164 | atomic_read(&kn->active) >= 0 || | ||
165 | RB_EMPTY_NODE(&kn->rb)); | ||
166 | } while (!RB_EMPTY_NODE(&kn->rb)); | ||
167 | 154 | ||
168 | if (kernfs_lockdep(kn)) | 155 | if (kernfs_lockdep(kn)) |
169 | rwsem_release(&kn->dep_map, 1, _RET_IP_); | 156 | rwsem_acquire_read(&kn->dep_map, 0, 1, _RET_IP_); |
170 | return NULL; | 157 | return kn; |
171 | } | 158 | } |
172 | 159 | ||
173 | /** | 160 | /** |
@@ -799,7 +786,6 @@ static void __kernfs_deactivate(struct kernfs_node *kn) | |||
799 | 786 | ||
800 | static void __kernfs_remove(struct kernfs_node *kn) | 787 | static void __kernfs_remove(struct kernfs_node *kn) |
801 | { | 788 | { |
802 | struct kernfs_root *root = kernfs_root(kn); | ||
803 | struct kernfs_node *pos; | 789 | struct kernfs_node *pos; |
804 | 790 | ||
805 | lockdep_assert_held(&kernfs_mutex); | 791 | lockdep_assert_held(&kernfs_mutex); |
@@ -851,9 +837,6 @@ static void __kernfs_remove(struct kernfs_node *kn) | |||
851 | 837 | ||
852 | kernfs_put(pos); | 838 | kernfs_put(pos); |
853 | } while (pos != kn); | 839 | } while (pos != kn); |
854 | |||
855 | /* some nodes killed, kick get_active waiters */ | ||
856 | wake_up_all(&root->deactivate_waitq); | ||
857 | } | 840 | } |
858 | 841 | ||
859 | /** | 842 | /** |