Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'rhashtable-fixes'

Thomas Graf says:

====================
rhashtable rehashing fixes

Some rhashtable rehashing bugs found while testing with the
next rhashtable self-test queued up for the next devel cycle:

https://github.com/tgraf/net-next/commits/rht

v2:
- Moved schedule_work() call into rhashtable_insert_rehash()
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+8 -3
+8 -3
lib/rhashtable.c
··· 405 405 406 406 if (rht_grow_above_75(ht, tbl)) 407 407 size *= 2; 408 - /* More than two rehashes (not resizes) detected. */ 409 - else if (WARN_ON(old_tbl != tbl && old_tbl->size == size)) 408 + /* Do not schedule more than one rehash */ 409 + else if (old_tbl != tbl) 410 410 return -EBUSY; 411 411 412 412 new_tbl = bucket_table_alloc(ht, size, GFP_ATOMIC); 413 - if (new_tbl == NULL) 413 + if (new_tbl == NULL) { 414 + /* Schedule async resize/rehash to try allocation 415 + * non-atomic context. 416 + */ 417 + schedule_work(&ht->run_work); 414 418 return -ENOMEM; 419 + } 415 420 416 421 err = rhashtable_rehash_attach(ht, tbl, new_tbl); 417 422 if (err) {