]> git.baikalelectronics.ru Git - kernel.git/commit
rhashtable: Do not schedule more than one rehash if we can't grow further
authorThomas Graf <tgraf@suug.ch>
Wed, 22 Apr 2015 07:41:46 +0000 (09:41 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Apr 2015 18:17:22 +0000 (14:17 -0400)
commit5e580ed8cba41a22071aa2217ac66637e3e51a8b
treea28503490179133baff9275d428a3c0c31f35e4e
parentb07c5dec5f0741a4a734c6ce011deed1f53fd589
rhashtable: Do not schedule more than one rehash if we can't grow further

The current code currently only stops inserting rehashes into the
chain when no resizes are currently scheduled. As long as resizes
are scheduled and while inserting above the utilization watermark,
more and more rehashes will be scheduled.

This lead to a perfect DoS storm with thousands of rehashes
scheduled which lead to thousands of spinlocks to be taken
sequentially.

Instead, only allow either a series of resizes or a single rehash.
Drop any further rehashes and return -EBUSY.

Fixes: 1e0d56c50346 ("rhashtable: Add immediate rehash during insertion")
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/rhashtable.c