aboutsummaryrefslogtreecommitdiffstats
path: root/fs/kernfs/symlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/kernfs/symlink.c')
-rw-r--r--fs/kernfs/symlink.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c
index 3a939c263ede..b2c106ca3434 100644
--- a/fs/kernfs/symlink.c
+++ b/fs/kernfs/symlink.c
@@ -27,6 +27,7 @@ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
27 struct kernfs_node *target) 27 struct kernfs_node *target)
28{ 28{
29 struct kernfs_node *kn; 29 struct kernfs_node *kn;
30 struct kernfs_addrm_cxt acxt;
30 int error; 31 int error;
31 32
32 kn = kernfs_new_node(kernfs_root(parent), name, S_IFLNK|S_IRWXUGO, 33 kn = kernfs_new_node(kernfs_root(parent), name, S_IFLNK|S_IRWXUGO,
@@ -39,7 +40,14 @@ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
39 kn->symlink.target_kn = target; 40 kn->symlink.target_kn = target;
40 kernfs_get(target); /* ref owned by symlink */ 41 kernfs_get(target); /* ref owned by symlink */
41 42
42 error = kernfs_add_one(kn, parent); 43 error = -ENOENT;
44 if (kernfs_get_active(parent)) {
45 kernfs_addrm_start(&acxt);
46 error = kernfs_add_one(&acxt, kn, parent);
47 kernfs_addrm_finish(&acxt);
48 kernfs_put_active(parent);
49 }
50
43 if (!error) 51 if (!error)
44 return kn; 52 return kn;
45 53