diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-12-01 07:44:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:55:22 -0500 |
commit | d392e49756a99ba51577d265d6db83e3f01c6ac8 (patch) | |
tree | 644610d6fc7ab79a9e8a7f76357062759ec8d690 | |
parent | 97577e38284f48ca773392e2d401af2f6c95dc08 (diff) |
[UNIX]: Move the sysctl_unix_max_dgram_qlen
This will make all the sub-namespaces always use the
default value (10) and leave the tuning via sysctl
to the init namespace only.
Per-namespace tuning is coming.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/net_namespace.h | 3 | ||||
-rw-r--r-- | net/unix/af_unix.c | 6 | ||||
-rw-r--r-- | net/unix/sysctl_net_unix.c | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 235214c4c231..b0cf07519b81 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -38,6 +38,9 @@ struct net { | |||
38 | /* List of all packet sockets. */ | 38 | /* List of all packet sockets. */ |
39 | rwlock_t packet_sklist_lock; | 39 | rwlock_t packet_sklist_lock; |
40 | struct hlist_head packet_sklist; | 40 | struct hlist_head packet_sklist; |
41 | |||
42 | /* unix sockets */ | ||
43 | int sysctl_unix_max_dgram_qlen; | ||
41 | }; | 44 | }; |
42 | 45 | ||
43 | #ifdef CONFIG_NET | 46 | #ifdef CONFIG_NET |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index a0aa6d3c2c08..73620d61762b 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -117,8 +117,6 @@ | |||
117 | #include <net/checksum.h> | 117 | #include <net/checksum.h> |
118 | #include <linux/security.h> | 118 | #include <linux/security.h> |
119 | 119 | ||
120 | int sysctl_unix_max_dgram_qlen __read_mostly = 10; | ||
121 | |||
122 | static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; | 120 | static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; |
123 | static DEFINE_SPINLOCK(unix_table_lock); | 121 | static DEFINE_SPINLOCK(unix_table_lock); |
124 | static atomic_t unix_nr_socks = ATOMIC_INIT(0); | 122 | static atomic_t unix_nr_socks = ATOMIC_INIT(0); |
@@ -594,7 +592,7 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) | |||
594 | &af_unix_sk_receive_queue_lock_key); | 592 | &af_unix_sk_receive_queue_lock_key); |
595 | 593 | ||
596 | sk->sk_write_space = unix_write_space; | 594 | sk->sk_write_space = unix_write_space; |
597 | sk->sk_max_ack_backlog = sysctl_unix_max_dgram_qlen; | 595 | sk->sk_max_ack_backlog = net->sysctl_unix_max_dgram_qlen; |
598 | sk->sk_destruct = unix_sock_destructor; | 596 | sk->sk_destruct = unix_sock_destructor; |
599 | u = unix_sk(sk); | 597 | u = unix_sk(sk); |
600 | u->dentry = NULL; | 598 | u->dentry = NULL; |
@@ -2140,6 +2138,8 @@ static int unix_net_init(struct net *net) | |||
2140 | { | 2138 | { |
2141 | int error = -ENOMEM; | 2139 | int error = -ENOMEM; |
2142 | 2140 | ||
2141 | net->sysctl_unix_max_dgram_qlen = 10; | ||
2142 | |||
2143 | #ifdef CONFIG_PROC_FS | 2143 | #ifdef CONFIG_PROC_FS |
2144 | if (!proc_net_fops_create(net, "unix", 0, &unix_seq_fops)) | 2144 | if (!proc_net_fops_create(net, "unix", 0, &unix_seq_fops)) |
2145 | goto out; | 2145 | goto out; |
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c index b2e0407e1b7b..c46cec04d23f 100644 --- a/net/unix/sysctl_net_unix.c +++ b/net/unix/sysctl_net_unix.c | |||
@@ -18,7 +18,7 @@ static ctl_table unix_table[] = { | |||
18 | { | 18 | { |
19 | .ctl_name = NET_UNIX_MAX_DGRAM_QLEN, | 19 | .ctl_name = NET_UNIX_MAX_DGRAM_QLEN, |
20 | .procname = "max_dgram_qlen", | 20 | .procname = "max_dgram_qlen", |
21 | .data = &sysctl_unix_max_dgram_qlen, | 21 | .data = &init_net.sysctl_unix_max_dgram_qlen, |
22 | .maxlen = sizeof(int), | 22 | .maxlen = sizeof(int), |
23 | .mode = 0644, | 23 | .mode = 0644, |
24 | .proc_handler = &proc_dointvec | 24 | .proc_handler = &proc_dointvec |