patch-2.1.34 linux/net/ipv4/ip_fragment.c

Next file: linux/net/ipv4/ip_masq_raudio.c
Previous file: linux/net/ipv4/fib.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.33/linux/net/ipv4/ip_fragment.c linux/net/ipv4/ip_fragment.c
@@ -46,7 +46,7 @@
 
 static struct ipq *ipqueue = NULL;		/* IP fragment queue	*/
 
-atomic_t ip_frag_mem = 0;			/* Memory used for fragments */
+atomic_t ip_frag_mem = ATOMIC_INIT;		/* Memory used for fragments */
 
 char *in_ntoa(unsigned long in);
 
@@ -105,7 +105,7 @@
 	 
 	save_flags(flags);
 	cli();
-	ip_frag_mem+=skb->truesize;
+	atomic_add(skb->truesize, &ip_frag_mem);
 	restore_flags(flags);
 
 	return(fp);
@@ -226,7 +226,7 @@
  
 static void ip_evictor(void)
 {
-	while(ip_frag_mem>IPFRAG_LOW_THRESH)
+	while(atomic_read(&ip_frag_mem)>IPFRAG_LOW_THRESH)
 	{
 		if(!ipqueue)
 			panic("ip_evictor: memcount");
@@ -422,7 +422,7 @@
 	 *	Start by cleaning up the memory
 	 */
 
-	if(ip_frag_mem>IPFRAG_HIGH_THRESH)
+	if(atomic_read(&ip_frag_mem)>IPFRAG_HIGH_THRESH)
 		ip_evictor();
 	/* 
 	 *	Find the entry of this IP datagram in the "incomplete datagrams" queue. 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov