Revert "kernfs: remove kernfs_addrm_cxt"
This reverts commit 99177a34110889a8f2c36420c34e3bcc9bfd8a70.
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>
diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c
index 3a939c263..b2c106c 100644
--- a/fs/kernfs/symlink.c
+++ b/fs/kernfs/symlink.c
@@ -27,6 +27,7 @@
struct kernfs_node *target)
{
struct kernfs_node *kn;
+ struct kernfs_addrm_cxt acxt;
int error;
kn = kernfs_new_node(kernfs_root(parent), name, S_IFLNK|S_IRWXUGO,
@@ -39,7 +40,14 @@
kn->symlink.target_kn = target;
kernfs_get(target); /* ref owned by symlink */
- error = kernfs_add_one(kn, parent);
+ error = -ENOENT;
+ if (kernfs_get_active(parent)) {
+ kernfs_addrm_start(&acxt);
+ error = kernfs_add_one(&acxt, kn, parent);
+ kernfs_addrm_finish(&acxt);
+ kernfs_put_active(parent);
+ }
+
if (!error)
return kn;