aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-12-08 01:07:56 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-12-08 01:07:56 -0500
commitbef986502fa398b1785a3979b1aa17cd902d3527 (patch)
treeb59c1afe7b1dfcc001b86e54863f550d7ddc8c34 /net/core/sock.c
parent4bdbd2807deeccc0793d57fb5120d7a53f2c0b3c (diff)
parentc99767974ebd2a719d849fdeaaa1674456f5283f (diff)
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/usb/input/hid.h
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index d472db4776c3..0ed5b4f0bc40 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -111,6 +111,7 @@
111#include <linux/poll.h> 111#include <linux/poll.h>
112#include <linux/tcp.h> 112#include <linux/tcp.h>
113#include <linux/init.h> 113#include <linux/init.h>
114#include <linux/highmem.h>
114 115
115#include <asm/uaccess.h> 116#include <asm/uaccess.h>
116#include <asm/system.h> 117#include <asm/system.h>
@@ -270,7 +271,7 @@ out:
270} 271}
271EXPORT_SYMBOL(sock_queue_rcv_skb); 272EXPORT_SYMBOL(sock_queue_rcv_skb);
272 273
273int sk_receive_skb(struct sock *sk, struct sk_buff *skb) 274int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested)
274{ 275{
275 int rc = NET_RX_SUCCESS; 276 int rc = NET_RX_SUCCESS;
276 277
@@ -279,7 +280,10 @@ int sk_receive_skb(struct sock *sk, struct sk_buff *skb)
279 280
280 skb->dev = NULL; 281 skb->dev = NULL;
281 282
282 bh_lock_sock(sk); 283 if (nested)
284 bh_lock_sock_nested(sk);
285 else
286 bh_lock_sock(sk);
283 if (!sock_owned_by_user(sk)) { 287 if (!sock_owned_by_user(sk)) {
284 /* 288 /*
285 * trylock + unlock semantics: 289 * trylock + unlock semantics:
@@ -806,24 +810,11 @@ lenout:
806 */ 810 */
807static void inline sock_lock_init(struct sock *sk) 811static void inline sock_lock_init(struct sock *sk)
808{ 812{
809 spin_lock_init(&sk->sk_lock.slock); 813 sock_lock_init_class_and_name(sk,
810 sk->sk_lock.owner = NULL; 814 af_family_slock_key_strings[sk->sk_family],
811 init_waitqueue_head(&sk->sk_lock.wq); 815 af_family_slock_keys + sk->sk_family,
812 /* 816 af_family_key_strings[sk->sk_family],
813 * Make sure we are not reinitializing a held lock: 817 af_family_keys + sk->sk_family);
814 */
815 debug_check_no_locks_freed((void *)&sk->sk_lock, sizeof(sk->sk_lock));
816
817 /*
818 * Mark both the sk_lock and the sk_lock.slock as a
819 * per-address-family lock class:
820 */
821 lockdep_set_class_and_name(&sk->sk_lock.slock,
822 af_family_slock_keys + sk->sk_family,
823 af_family_slock_key_strings[sk->sk_family]);
824 lockdep_init_map(&sk->sk_lock.dep_map,
825 af_family_key_strings[sk->sk_family],
826 af_family_keys + sk->sk_family, 0);
827} 818}
828 819
829/** 820/**
@@ -837,7 +828,7 @@ struct sock *sk_alloc(int family, gfp_t priority,
837 struct proto *prot, int zero_it) 828 struct proto *prot, int zero_it)
838{ 829{
839 struct sock *sk = NULL; 830 struct sock *sk = NULL;
840 kmem_cache_t *slab = prot->slab; 831 struct kmem_cache *slab = prot->slab;
841 832
842 if (slab != NULL) 833 if (slab != NULL)
843 sk = kmem_cache_alloc(slab, priority); 834 sk = kmem_cache_alloc(slab, priority);
@@ -1160,7 +1151,7 @@ static struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
1160 goto failure; 1151 goto failure;
1161 1152
1162 if (atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) { 1153 if (atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
1163 skb = alloc_skb(header_len, sk->sk_allocation); 1154 skb = alloc_skb(header_len, gfp_mask);
1164 if (skb) { 1155 if (skb) {
1165 int npages; 1156 int npages;
1166 int i; 1157 int i;
@@ -1527,7 +1518,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
1527 atomic_set(&sk->sk_refcnt, 1); 1518 atomic_set(&sk->sk_refcnt, 1);
1528} 1519}
1529 1520
1530void fastcall lock_sock(struct sock *sk) 1521void fastcall lock_sock_nested(struct sock *sk, int subclass)
1531{ 1522{
1532 might_sleep(); 1523 might_sleep();
1533 spin_lock_bh(&sk->sk_lock.slock); 1524 spin_lock_bh(&sk->sk_lock.slock);
@@ -1538,11 +1529,11 @@ void fastcall lock_sock(struct sock *sk)
1538 /* 1529 /*
1539 * The sk_lock has mutex_lock() semantics here: 1530 * The sk_lock has mutex_lock() semantics here:
1540 */ 1531 */
1541 mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_); 1532 mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_);
1542 local_bh_enable(); 1533 local_bh_enable();
1543} 1534}
1544 1535
1545EXPORT_SYMBOL(lock_sock); 1536EXPORT_SYMBOL(lock_sock_nested);
1546 1537
1547void fastcall release_sock(struct sock *sk) 1538void fastcall release_sock(struct sock *sk)
1548{ 1539{