diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 21:08:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 21:08:58 -0400 |
commit | f1d38e423a697b7aa06e12d3ca4753bcc1aa3531 (patch) | |
tree | 1cbfd86070f724d5ffe53146d4c67edf14cccf98 /net/sysctl_net.c | |
parent | dae430c6f6e5d0b98c238c340a41a39e221e8940 (diff) | |
parent | 4e474a00d7ff746ed177ddae14fa8b2d4bad7a00 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/sysctl
Pull sysctl updates from Eric Biederman:
- Rewrite of sysctl for speed and clarity.
Insert/remove/Lookup in sysctl are all now O(NlogN) operations, and
are no longer bottlenecks in the process of adding and removing
network devices.
sysctl is now focused on being a filesystem instead of system call
and the code can all be found in fs/proc/proc_sysctl.c. Hopefully
this means the code is now approachable.
Much thanks is owed to Lucian Grinjincu for keeping at this until
something was found that was usable.
- The recent proc_sys_poll oops found by the fuzzer during hibernation
is fixed.
* git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/sysctl: (36 commits)
sysctl: protect poll() in entries that may go away
sysctl: Don't call sysctl_follow_link unless we are a link.
sysctl: Comments to make the code clearer.
sysctl: Correct error return from get_subdir
sysctl: An easier to read version of find_subdir
sysctl: fix memset parameters in setup_sysctl_set()
sysctl: remove an unused variable
sysctl: Add register_sysctl for normal sysctl users
sysctl: Index sysctl directories with rbtrees.
sysctl: Make the header lists per directory.
sysctl: Move sysctl_check_dups into insert_header
sysctl: Modify __register_sysctl_paths to take a set instead of a root and an nsproxy
sysctl: Replace root_list with links between sysctl_table_sets.
sysctl: Add sysctl_print_dir and use it in get_subdir
sysctl: Stop requiring explicit management of sysctl directories
sysctl: Add a root pointer to ctl_table_set
sysctl: Rewrite proc_sys_readdir in terms of first_entry and next_entry
sysctl: Rewrite proc_sys_lookup introducing find_entry and lookup_entry.
sysctl: Normalize the root_table data structure.
sysctl: Factor out insert_header and erase_header
...
Diffstat (limited to 'net/sysctl_net.c')
-rw-r--r-- | net/sysctl_net.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/net/sysctl_net.c b/net/sysctl_net.c index e75813904f26..c3e65aebecc0 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c | |||
@@ -74,15 +74,13 @@ static struct ctl_table_root net_sysctl_ro_root = { | |||
74 | 74 | ||
75 | static int __net_init sysctl_net_init(struct net *net) | 75 | static int __net_init sysctl_net_init(struct net *net) |
76 | { | 76 | { |
77 | setup_sysctl_set(&net->sysctls, | 77 | setup_sysctl_set(&net->sysctls, &net_sysctl_root, is_seen); |
78 | &net_sysctl_ro_root.default_set, | ||
79 | is_seen); | ||
80 | return 0; | 78 | return 0; |
81 | } | 79 | } |
82 | 80 | ||
83 | static void __net_exit sysctl_net_exit(struct net *net) | 81 | static void __net_exit sysctl_net_exit(struct net *net) |
84 | { | 82 | { |
85 | WARN_ON(!list_empty(&net->sysctls.list)); | 83 | retire_sysctl_set(&net->sysctls); |
86 | } | 84 | } |
87 | 85 | ||
88 | static struct pernet_operations sysctl_pernet_ops = { | 86 | static struct pernet_operations sysctl_pernet_ops = { |
@@ -90,36 +88,32 @@ static struct pernet_operations sysctl_pernet_ops = { | |||
90 | .exit = sysctl_net_exit, | 88 | .exit = sysctl_net_exit, |
91 | }; | 89 | }; |
92 | 90 | ||
93 | static __init int sysctl_init(void) | 91 | static __init int net_sysctl_init(void) |
94 | { | 92 | { |
95 | int ret; | 93 | int ret; |
96 | ret = register_pernet_subsys(&sysctl_pernet_ops); | 94 | ret = register_pernet_subsys(&sysctl_pernet_ops); |
97 | if (ret) | 95 | if (ret) |
98 | goto out; | 96 | goto out; |
99 | register_sysctl_root(&net_sysctl_root); | 97 | setup_sysctl_set(&net_sysctl_ro_root.default_set, &net_sysctl_ro_root, NULL); |
100 | setup_sysctl_set(&net_sysctl_ro_root.default_set, NULL, NULL); | ||
101 | register_sysctl_root(&net_sysctl_ro_root); | 98 | register_sysctl_root(&net_sysctl_ro_root); |
99 | register_sysctl_root(&net_sysctl_root); | ||
102 | out: | 100 | out: |
103 | return ret; | 101 | return ret; |
104 | } | 102 | } |
105 | subsys_initcall(sysctl_init); | 103 | subsys_initcall(net_sysctl_init); |
106 | 104 | ||
107 | struct ctl_table_header *register_net_sysctl_table(struct net *net, | 105 | struct ctl_table_header *register_net_sysctl_table(struct net *net, |
108 | const struct ctl_path *path, struct ctl_table *table) | 106 | const struct ctl_path *path, struct ctl_table *table) |
109 | { | 107 | { |
110 | struct nsproxy namespaces; | 108 | return __register_sysctl_paths(&net->sysctls, path, table); |
111 | namespaces = *current->nsproxy; | ||
112 | namespaces.net_ns = net; | ||
113 | return __register_sysctl_paths(&net_sysctl_root, | ||
114 | &namespaces, path, table); | ||
115 | } | 109 | } |
116 | EXPORT_SYMBOL_GPL(register_net_sysctl_table); | 110 | EXPORT_SYMBOL_GPL(register_net_sysctl_table); |
117 | 111 | ||
118 | struct ctl_table_header *register_net_sysctl_rotable(const | 112 | struct ctl_table_header *register_net_sysctl_rotable(const |
119 | struct ctl_path *path, struct ctl_table *table) | 113 | struct ctl_path *path, struct ctl_table *table) |
120 | { | 114 | { |
121 | return __register_sysctl_paths(&net_sysctl_ro_root, | 115 | return __register_sysctl_paths(&net_sysctl_ro_root.default_set, |
122 | &init_nsproxy, path, table); | 116 | path, table); |
123 | } | 117 | } |
124 | EXPORT_SYMBOL_GPL(register_net_sysctl_rotable); | 118 | EXPORT_SYMBOL_GPL(register_net_sysctl_rotable); |
125 | 119 | ||