git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
net
/
core
/
sock.c
diff --git
a/net/core/sock.c
b/net/core/sock.c
index
937a72b
..
3ca5f8d
100644
(file)
--- a/
net/core/sock.c
+++ b/
net/core/sock.c
@@
-111,6
+111,7
@@
#include <linux/poll.h>
#include <linux/tcp.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/tcp.h>
#include <linux/init.h>
+#include <linux/highmem.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/system.h>
@@
-190,13
+191,13
@@
static struct lock_class_key af_callback_keys[AF_MAX];
#define SK_RMEM_MAX (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)
/* Run time adjustable parameters. */
#define SK_RMEM_MAX (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)
/* Run time adjustable parameters. */
-__u32 sysctl_wmem_max = SK_WMEM_MAX;
-__u32 sysctl_rmem_max = SK_RMEM_MAX;
-__u32 sysctl_wmem_default = SK_WMEM_MAX;
-__u32 sysctl_rmem_default = SK_RMEM_MAX;
+__u32 sysctl_wmem_max
__read_mostly
= SK_WMEM_MAX;
+__u32 sysctl_rmem_max
__read_mostly
= SK_RMEM_MAX;
+__u32 sysctl_wmem_default
__read_mostly
= SK_WMEM_MAX;
+__u32 sysctl_rmem_default
__read_mostly
= SK_RMEM_MAX;
/* Maximal space eaten by iovec or ancilliary data plus some space */
/* Maximal space eaten by iovec or ancilliary data plus some space */
-int sysctl_optmem_max
= sizeof(unsigned long)*(2*UIO_MAXIOV +
512);
+int sysctl_optmem_max
__read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+
512);
static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
{
static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
{
@@
-250,11
+251,7
@@
int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
goto out;
}
goto out;
}
- /* It would be deadlock, if sock_queue_rcv_skb is used
- with socket lock! We assume that users of this
- function are lock free.
- */
- err = sk_filter(sk, skb, 1);
+ err = sk_filter(sk, skb);
if (err)
goto out;
if (err)
goto out;
@@
-277,16
+274,19
@@
out:
}
EXPORT_SYMBOL(sock_queue_rcv_skb);
}
EXPORT_SYMBOL(sock_queue_rcv_skb);
-int sk_receive_skb(struct sock *sk, struct sk_buff *skb)
+int sk_receive_skb(struct sock *sk, struct sk_buff *skb
, const int nested
)
{
int rc = NET_RX_SUCCESS;
{
int rc = NET_RX_SUCCESS;
- if (sk_filter(sk, skb
, 0
))
+ if (sk_filter(sk, skb))
goto discard_and_relse;
skb->dev = NULL;
goto discard_and_relse;
skb->dev = NULL;
- bh_lock_sock(sk);
+ if (nested)
+ bh_lock_sock_nested(sk);
+ else
+ bh_lock_sock(sk);
if (!sock_owned_by_user(sk)) {
/*
* trylock + unlock semantics:
if (!sock_owned_by_user(sk)) {
/*
* trylock + unlock semantics:
@@
-609,15
+609,15
@@
set_rcvbuf:
break;
case SO_DETACH_FILTER:
break;
case SO_DETACH_FILTER:
-
spin_lock_bh(&sk->sk_lock.slock
);
- filter =
sk->sk_filter
;
+
rcu_read_lock_bh(
);
+ filter =
rcu_dereference(sk->sk_filter)
;
if (filter) {
if (filter) {
- sk->sk_filter = NULL;
- spin_unlock_bh(&sk->sk_lock.slock);
+ rcu_assign_pointer(sk->sk_filter, NULL);
sk_filter_release(sk, filter);
sk_filter_release(sk, filter);
+ rcu_read_unlock_bh();
break;
}
break;
}
-
spin_unlock_bh(&sk->sk_lock.slock
);
+
rcu_read_unlock_bh(
);
ret = -ENONET;
break;
ret = -ENONET;
break;
@@
-831,7
+831,7
@@
struct sock *sk_alloc(int family, gfp_t priority,
struct proto *prot, int zero_it)
{
struct sock *sk = NULL;
struct proto *prot, int zero_it)
{
struct sock *sk = NULL;
-
kmem_cache_t
*slab = prot->slab;
+
struct kmem_cache
*slab = prot->slab;
if (slab != NULL)
sk = kmem_cache_alloc(slab, priority);
if (slab != NULL)
sk = kmem_cache_alloc(slab, priority);
@@
-876,10
+876,10
@@
void sk_free(struct sock *sk)
if (sk->sk_destruct)
sk->sk_destruct(sk);
if (sk->sk_destruct)
sk->sk_destruct(sk);
- filter =
sk->sk_filter
;
+ filter =
rcu_dereference(sk->sk_filter)
;
if (filter) {
sk_filter_release(sk, filter);
if (filter) {
sk_filter_release(sk, filter);
-
sk->sk_filter = NULL
;
+
rcu_assign_pointer(sk->sk_filter, NULL)
;
}
sock_disable_timestamp(sk);
}
sock_disable_timestamp(sk);
@@
-901,14
+901,14
@@
void sk_free(struct sock *sk)
module_put(owner);
}
module_put(owner);
}
-struct sock *sk_clone(struct sock *sk, const gfp_t priority)
+struct sock *sk_clone(
const
struct sock *sk, const gfp_t priority)
{
struct sock *newsk = sk_alloc(sk->sk_family, priority, sk->sk_prot, 0);
if (newsk != NULL) {
struct sk_filter *filter;
{
struct sock *newsk = sk_alloc(sk->sk_family, priority, sk->sk_prot, 0);
if (newsk != NULL) {
struct sk_filter *filter;
-
memcpy(newsk, sk, sk->sk_prot->obj_size
);
+
sock_copy(newsk, sk
);
/* SANITY */
sock_vx_init(newsk);
/* SANITY */
sock_vx_init(newsk);
@@
-945,9
+945,6
@@
struct sock *sk_clone(struct sock *sk, const gfp_t priority)
if (filter != NULL)
sk_filter_charge(newsk, filter);
if (filter != NULL)
sk_filter_charge(newsk, filter);
- if (sk->sk_create_child)
- sk->sk_create_child(sk, newsk);
-
if (unlikely(xfrm_sk_clone_policy(newsk))) {
/* It is still raw copy of parent, so invalidate
* destructor and make plain sk_free() */
if (unlikely(xfrm_sk_clone_policy(newsk))) {
/* It is still raw copy of parent, so invalidate
* destructor and make plain sk_free() */
@@
-1544,7
+1541,7
@@
void sock_init_data(struct socket *sock, struct sock *sk)
atomic_set(&sk->sk_refcnt, 1);
}
atomic_set(&sk->sk_refcnt, 1);
}
-void fastcall lock_sock
(struct sock *sk
)
+void fastcall lock_sock
_nested(struct sock *sk, int subclass
)
{
might_sleep();
spin_lock_bh(&sk->sk_lock.slock);
{
might_sleep();
spin_lock_bh(&sk->sk_lock.slock);
@@
-1555,11
+1552,11
@@
void fastcall lock_sock(struct sock *sk)
/*
* The sk_lock has mutex_lock() semantics here:
*/
/*
* The sk_lock has mutex_lock() semantics here:
*/
- mutex_acquire(&sk->sk_lock.dep_map,
0
, 0, _RET_IP_);
+ mutex_acquire(&sk->sk_lock.dep_map,
subclass
, 0, _RET_IP_);
local_bh_enable();
}
local_bh_enable();
}
-EXPORT_SYMBOL(lock_sock);
+EXPORT_SYMBOL(lock_sock
_nested
);
void fastcall release_sock(struct sock *sk)
{
void fastcall release_sock(struct sock *sk)
{
@@
-1623,7
+1620,7
@@
int compat_sock_common_getsockopt(struct socket *sock, int level, int optname,
{
struct sock *sk = sock->sk;
{
struct sock *sk = sock->sk;
- if (sk->sk_prot->compat_
s
etsockopt != NULL)
+ if (sk->sk_prot->compat_
g
etsockopt != NULL)
return sk->sk_prot->compat_getsockopt(sk, level, optname,
optval, optlen);
return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);
return sk->sk_prot->compat_getsockopt(sk, level, optname,
optval, optlen);
return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);