diff options
author | Tejun Heo <tj@kernel.org> | 2014-02-03 14:02:58 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-07 18:42:40 -0500 |
commit | 988cd7afb3f37598891ca70b4c6eb914c338c46a (patch) | |
tree | cea29f9fe0d8057441f3350235ec1666ff231d7a /fs/kernfs/file.c | |
parent | ccf02aaf8167bb8bfb3c17c01c843d309b872671 (diff) |
kernfs: remove kernfs_addrm_cxt
kernfs_addrm_cxt and the accompanying kernfs_addrm_start/finish() were
added because there were operations which should be performed outside
kernfs_mutex after adding and removing kernfs_nodes. The necessary
operations were recorded in kernfs_addrm_cxt and performed by
kernfs_addrm_finish(); however, after the recent changes which
relocated deactivation and unmapping so that they're performed
directly during removal, the only operation kernfs_addrm_finish()
performs is kernfs_put(), which can be moved inside the removal path
too.
This patch moves the kernfs_put() of the base ref to __kernfs_remove()
and remove kernfs_addrm_cxt and kernfs_addrm_start/finish().
* kernfs_add_one() is updated to grab and release kernfs_mutex itself.
sysfs_addrm_start/finish() invocations around it are removed from
all users.
* __kernfs_remove() puts an unlinked node directly instead of chaining
it to kernfs_addrm_cxt. Its callers are updated to grab and release
kernfs_mutex instead of calling kernfs_addrm_start/finish() around
it.
v2: Rebased on top of "kernfs: associate a new kernfs_node with its
parent on creation" which dropped @parent from kernfs_add_one().
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs/file.c')
-rw-r--r-- | fs/kernfs/file.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index dbf397bfdff2..10a8c91c49d6 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c | |||
@@ -820,7 +820,6 @@ struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent, | |||
820 | bool name_is_static, | 820 | bool name_is_static, |
821 | struct lock_class_key *key) | 821 | struct lock_class_key *key) |
822 | { | 822 | { |
823 | struct kernfs_addrm_cxt acxt; | ||
824 | struct kernfs_node *kn; | 823 | struct kernfs_node *kn; |
825 | unsigned flags; | 824 | unsigned flags; |
826 | int rc; | 825 | int rc; |
@@ -855,10 +854,7 @@ struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent, | |||
855 | if (ops->mmap) | 854 | if (ops->mmap) |
856 | kn->flags |= KERNFS_HAS_MMAP; | 855 | kn->flags |= KERNFS_HAS_MMAP; |
857 | 856 | ||
858 | kernfs_addrm_start(&acxt); | 857 | rc = kernfs_add_one(kn); |
859 | rc = kernfs_add_one(&acxt, kn); | ||
860 | kernfs_addrm_finish(&acxt); | ||
861 | |||
862 | if (rc) { | 858 | if (rc) { |
863 | kernfs_put(kn); | 859 | kernfs_put(kn); |
864 | return ERR_PTR(rc); | 860 | return ERR_PTR(rc); |