summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-04-22 14:17:23 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-22 14:17:23 -0400
commita2c3935aaa8fe99dbddb13ff244ecec7c324ec8b (patch)
treea28503490179133baff9275d428a3c0c31f35e4e
parentd83769a580f1132ac26439f50068a29b02be535e (diff)
parenta87b9ebf1709687ff213091d0fdb4254b1564803 (diff)
downloadop-kernel-dev-a2c3935aaa8fe99dbddb13ff244ecec7c324ec8b.zip
op-kernel-dev-a2c3935aaa8fe99dbddb13ff244ecec7c324ec8b.tar.gz
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>
-rw-r--r--lib/rhashtable.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 4898442..b28df40 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -405,13 +405,18 @@ int rhashtable_insert_rehash(struct rhashtable *ht)
if (rht_grow_above_75(ht, tbl))
size *= 2;
- /* More than two rehashes (not resizes) detected. */
- else if (WARN_ON(old_tbl != tbl && old_tbl->size == size))
+ /* Do not schedule more than one rehash */
+ else if (old_tbl != tbl)
return -EBUSY;
new_tbl = bucket_table_alloc(ht, size, GFP_ATOMIC);
- if (new_tbl == NULL)
+ if (new_tbl == NULL) {
+ /* Schedule async resize/rehash to try allocation
+ * non-atomic context.
+ */
+ schedule_work(&ht->run_work);
return -ENOMEM;
+ }
err = rhashtable_rehash_attach(ht, tbl, new_tbl);
if (err) {
OpenPOWER on IntegriCloud