Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2c3935a authored by David S. Miller's avatar David S. Miller
Browse files

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: default avatarDavid S. Miller <davem@davemloft.net>
parents d83769a5 a87b9ebf
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -405,13 +405,18 @@ int rhashtable_insert_rehash(struct rhashtable *ht)


	if (rht_grow_above_75(ht, tbl))
	if (rht_grow_above_75(ht, tbl))
		size *= 2;
		size *= 2;
	/* More than two rehashes (not resizes) detected. */
	/* Do not schedule more than one rehash */
	else if (WARN_ON(old_tbl != tbl && old_tbl->size == size))
	else if (old_tbl != tbl)
		return -EBUSY;
		return -EBUSY;


	new_tbl = bucket_table_alloc(ht, size, GFP_ATOMIC);
	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;
		return -ENOMEM;
	}


	err = rhashtable_rehash_attach(ht, tbl, new_tbl);
	err = rhashtable_rehash_attach(ht, tbl, new_tbl);
	if (err) {
	if (err) {