diff options
Diffstat (limited to 'net/ipv4/tcp_minisocks.c')
-rw-r--r-- | net/ipv4/tcp_minisocks.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index f42a284164b7..f8e288c8d693 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -84,7 +84,7 @@ static void tcp_timewait_kill(struct tcp_tw_bucket *tw) | |||
84 | tcp_bucket_destroy(tb); | 84 | tcp_bucket_destroy(tb); |
85 | spin_unlock(&bhead->lock); | 85 | spin_unlock(&bhead->lock); |
86 | 86 | ||
87 | #ifdef INET_REFCNT_DEBUG | 87 | #ifdef SOCK_REFCNT_DEBUG |
88 | if (atomic_read(&tw->tw_refcnt) != 1) { | 88 | if (atomic_read(&tw->tw_refcnt) != 1) { |
89 | printk(KERN_DEBUG "tw_bucket %p refcnt=%d\n", tw, | 89 | printk(KERN_DEBUG "tw_bucket %p refcnt=%d\n", tw, |
90 | atomic_read(&tw->tw_refcnt)); | 90 | atomic_read(&tw->tw_refcnt)); |
@@ -799,9 +799,21 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, | |||
799 | newsk->sk_err = 0; | 799 | newsk->sk_err = 0; |
800 | newsk->sk_priority = 0; | 800 | newsk->sk_priority = 0; |
801 | atomic_set(&newsk->sk_refcnt, 2); | 801 | atomic_set(&newsk->sk_refcnt, 2); |
802 | #ifdef INET_REFCNT_DEBUG | 802 | |
803 | atomic_inc(&inet_sock_nr); | 803 | /* |
804 | #endif | 804 | * Increment the counter in the same struct proto as the master |
805 | * sock (sk_refcnt_debug_inc uses newsk->sk_prot->socks, that | ||
806 | * is the same as sk->sk_prot->socks, as this field was copied | ||
807 | * with memcpy), same rationale as the first comment in this | ||
808 | * function. | ||
809 | * | ||
810 | * This _changes_ the previous behaviour, where | ||
811 | * tcp_create_openreq_child always was incrementing the | ||
812 | * equivalent to tcp_prot->socks (inet_sock_nr), so this have | ||
813 | * to be taken into account in all callers. -acme | ||
814 | */ | ||
815 | sk_refcnt_debug_inc(newsk); | ||
816 | |||
805 | atomic_inc(&tcp_sockets_allocated); | 817 | atomic_inc(&tcp_sockets_allocated); |
806 | 818 | ||
807 | if (sock_flag(newsk, SOCK_KEEPOPEN)) | 819 | if (sock_flag(newsk, SOCK_KEEPOPEN)) |