Thread (43 messages) 43 messages, 9 authors, 2004-10-03

Re: [6/6]: jenkins hash for neigh

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2004-09-27 11:48:33

David S. Miller [off-list ref] wrote:
quoted hunk ↗ jump to hunk
3) Fix locking and GFP_* bugs.
@@ -400,8 +400,11 @@
 		goto out;
 	}
 
-	if (tbl->entries > (tbl->hash_mask + 1))
+	if (tbl->entries > (tbl->hash_mask + 1)) {
+		write_lock_bh(&tbl->lock);
 		neigh_hash_grow(tbl, (tbl->hash_mask + 1) << 1);
+		write_unlock_bh(&tbl->lock);
+	}
The locking should be outside the if block as otherwise you may grow
unnecessarily or grow into the same size :)
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help