]> Pileus Git - ~andy/linux/commitdiff
Revert "kernfs: make kernfs_get_active() block if the node is deactivated but not...
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Jan 2014 22:13:39 +0000 (14:13 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Jan 2014 22:13:39 +0000 (14:13 -0800)
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>
fs/kernfs/dir.c

index 37dd6408f5f607ea58d84fd0d61b140ae3f8c7e6..770d687ee9f3c42e3ee651817ef424bf62132bbd 100644 (file)
@@ -149,25 +149,12 @@ struct kernfs_node *kernfs_get_active(struct kernfs_node *kn)
        if (unlikely(!kn))
                return NULL;
 
-       if (kernfs_lockdep(kn))
-               rwsem_acquire_read(&kn->dep_map, 0, 1, _RET_IP_);
-
-       /*
-        * Try to obtain an active ref.  If @kn is deactivated, we block
-        * till either it's reactivated or killed.
-        */
-       do {
-               if (atomic_inc_unless_negative(&kn->active))
-                       return kn;
-
-               wait_event(kernfs_root(kn)->deactivate_waitq,
-                          atomic_read(&kn->active) >= 0 ||
-                          RB_EMPTY_NODE(&kn->rb));
-       } while (!RB_EMPTY_NODE(&kn->rb));
+       if (!atomic_inc_unless_negative(&kn->active))
+               return NULL;
 
        if (kernfs_lockdep(kn))
-               rwsem_release(&kn->dep_map, 1, _RET_IP_);
-       return NULL;
+               rwsem_acquire_read(&kn->dep_map, 0, 1, _RET_IP_);
+       return kn;
 }
 
 /**
@@ -799,7 +786,6 @@ static void __kernfs_deactivate(struct kernfs_node *kn)
 
 static void __kernfs_remove(struct kernfs_node *kn)
 {
-       struct kernfs_root *root = kernfs_root(kn);
        struct kernfs_node *pos;
 
        lockdep_assert_held(&kernfs_mutex);
@@ -851,9 +837,6 @@ static void __kernfs_remove(struct kernfs_node *kn)
 
                kernfs_put(pos);
        } while (pos != kn);
-
-       /* some nodes killed, kick get_active waiters */
-       wake_up_all(&root->deactivate_waitq);
 }
 
 /**