summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rhashtable.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 6c902639728b..bf956b85455a 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -584,10 +584,6 @@ static struct bucket_table *rhashtable_insert_one(
*/
rht_assign_locked(bkt, obj);
- atomic_inc(&ht->nelems);
- if (rht_grow_above_75(ht, tbl))
- schedule_work(&ht->run_work);
-
return NULL;
}
@@ -624,6 +620,12 @@ static void *rhashtable_try_insert(struct rhashtable *ht, const void *key,
data = ERR_CAST(new_tbl);
rht_unlock(tbl, bkt, flags);
+
+ if (PTR_ERR(data) == -ENOENT && !new_tbl) {
+ atomic_inc(&ht->nelems);
+ if (rht_grow_above_75(ht, tbl))
+ schedule_work(&ht->run_work);
+ }
}
} while (!IS_ERR_OR_NULL(new_tbl));