aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-08-06 04:44:24 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-15 02:17:26 -0400
commit632c928a6a77fe96cda34a9978e1f6019ffc38f4 (patch)
tree40c5c2d702b04ae16a73f628deaac2e54c2ce79d /net/sctp
parent2ce955035081112cf1590c961da8d94324142b5e (diff)
sctp: Move the percpu sockets counter out of sctp_proc_init
The percpu sctp socket counter has nothing at all to do with the sctp proc files, and having it in the wrong initialization is confusing, and makes network namespace support a pain. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Vlad Yasevich <vyasevich@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/protocol.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index f20bd708e89c..48a5989c98ce 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -93,8 +93,6 @@ int sysctl_sctp_wmem[3];
93/* Set up the proc fs entry for the SCTP protocol. */ 93/* Set up the proc fs entry for the SCTP protocol. */
94static __init int sctp_proc_init(void) 94static __init int sctp_proc_init(void)
95{ 95{
96 if (percpu_counter_init(&sctp_sockets_allocated, 0))
97 goto out_nomem;
98#ifdef CONFIG_PROC_FS 96#ifdef CONFIG_PROC_FS
99 if (!proc_net_sctp) { 97 if (!proc_net_sctp) {
100 proc_net_sctp = proc_mkdir("sctp", init_net.proc_net); 98 proc_net_sctp = proc_mkdir("sctp", init_net.proc_net);
@@ -125,12 +123,9 @@ out_snmp_proc_init:
125 remove_proc_entry("sctp", init_net.proc_net); 123 remove_proc_entry("sctp", init_net.proc_net);
126 } 124 }
127out_free_percpu: 125out_free_percpu:
128 percpu_counter_destroy(&sctp_sockets_allocated);
129#else 126#else
130 return 0; 127 return 0;
131#endif /* CONFIG_PROC_FS */ 128#endif /* CONFIG_PROC_FS */
132
133out_nomem:
134 return -ENOMEM; 129 return -ENOMEM;
135} 130}
136 131
@@ -151,7 +146,6 @@ static void sctp_proc_exit(void)
151 remove_proc_entry("sctp", init_net.proc_net); 146 remove_proc_entry("sctp", init_net.proc_net);
152 } 147 }
153#endif 148#endif
154 percpu_counter_destroy(&sctp_sockets_allocated);
155} 149}
156 150
157/* Private helper to extract ipv4 address and stash them in 151/* Private helper to extract ipv4 address and stash them in
@@ -1261,6 +1255,10 @@ SCTP_STATIC __init int sctp_init(void)
1261 if (status) 1255 if (status)
1262 goto err_init_mibs; 1256 goto err_init_mibs;
1263 1257
1258 status = percpu_counter_init(&sctp_sockets_allocated, 0);
1259 if (status)
1260 goto err_percpu_counter_init;
1261
1264 /* Initialize proc fs directory. */ 1262 /* Initialize proc fs directory. */
1265 status = sctp_proc_init(); 1263 status = sctp_proc_init();
1266 if (status) 1264 if (status)
@@ -1481,6 +1479,8 @@ err_ahash_alloc:
1481 sctp_dbg_objcnt_exit(); 1479 sctp_dbg_objcnt_exit();
1482 sctp_proc_exit(); 1480 sctp_proc_exit();
1483err_init_proc: 1481err_init_proc:
1482 percpu_counter_destroy(&sctp_sockets_allocated);
1483err_percpu_counter_init:
1484 cleanup_sctp_mibs(); 1484 cleanup_sctp_mibs();
1485err_init_mibs: 1485err_init_mibs:
1486 kmem_cache_destroy(sctp_chunk_cachep); 1486 kmem_cache_destroy(sctp_chunk_cachep);
@@ -1521,6 +1521,7 @@ SCTP_STATIC __exit void sctp_exit(void)
1521 sizeof(struct sctp_bind_hashbucket))); 1521 sizeof(struct sctp_bind_hashbucket)));
1522 1522
1523 sctp_dbg_objcnt_exit(); 1523 sctp_dbg_objcnt_exit();
1524 percpu_counter_destroy(&sctp_sockets_allocated);
1524 sctp_proc_exit(); 1525 sctp_proc_exit();
1525 cleanup_sctp_mibs(); 1526 cleanup_sctp_mibs();
1526 1527