aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rhashtable.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 4898442b837f..b28df4019ade 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -405,13 +405,18 @@ int rhashtable_insert_rehash(struct rhashtable *ht)
405 405
406 if (rht_grow_above_75(ht, tbl)) 406 if (rht_grow_above_75(ht, tbl))
407 size *= 2; 407 size *= 2;
408 /* More than two rehashes (not resizes) detected. */ 408 /* Do not schedule more than one rehash */
409 else if (WARN_ON(old_tbl != tbl && old_tbl->size == size)) 409 else if (old_tbl != tbl)
410 return -EBUSY; 410 return -EBUSY;
411 411
412 new_tbl = bucket_table_alloc(ht, size, GFP_ATOMIC); 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 return -ENOMEM; 418 return -ENOMEM;
419 }
415 420
416 err = rhashtable_rehash_attach(ht, tbl, new_tbl); 421 err = rhashtable_rehash_attach(ht, tbl, new_tbl);
417 if (err) { 422 if (err) {