]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/inet_timewait_sock.c
Merge branch 'master' of ../linux-2.6/
[linux-2.6-omap-h63xx.git] / net / ipv4 / inet_timewait_sock.c
index d43e787031a4618341988286364160193137219b..876169f3a5286db53d6371763549941a578cb445 100644 (file)
@@ -48,6 +48,21 @@ static void __inet_twsk_kill(struct inet_timewait_sock *tw,
        inet_twsk_put(tw);
 }
 
+void inet_twsk_put(struct inet_timewait_sock *tw)
+{
+       if (atomic_dec_and_test(&tw->tw_refcnt)) {
+               struct module *owner = tw->tw_prot->owner;
+               twsk_destructor((struct sock *)tw);
+#ifdef SOCK_REFCNT_DEBUG
+               printk(KERN_DEBUG "%s timewait_sock %p released\n",
+                      tw->tw_prot->name, tw);
+#endif
+               kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
+               module_put(owner);
+       }
+}
+EXPORT_SYMBOL_GPL(inet_twsk_put);
+
 /*
  * Enter the time wait state. This is called with locally disabled BH.
  * Essentially we whip up a timewait bucket, copy the relevant info into it
@@ -76,7 +91,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
 
        /* Step 2: Remove SK from established hash. */
        if (__sk_del_node_init(sk))
-               sock_prot_dec_use(sk->sk_prot);
+               sock_prot_inuse_add(sk->sk_prot, -1);
 
        /* Step 3: Hash TW into TIMEWAIT chain. */
        inet_twsk_add_node(tw, &ehead->twchain);