]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - lib/rhashtable.c
rhashtable: Fix walker behaviour during rehash
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 14 Mar 2015 02:57:20 +0000 (13:57 +1100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Mar 2015 05:35:34 +0000 (01:35 -0400)
commiteddee5ba34eb6c9890ef106f19ead2b370e5342f
tree2cf7fcc92a1e2c2f541eda13aef5efd38501a0fb
parent96026d057a1fb7da1e314a24e3a1c528321ed45e
rhashtable: Fix walker behaviour during rehash

Previously whenever the walker encountered a resize it simply
snaps back to the beginning and starts again.  However, this only
works if the rehash started and completed while the walker was
idle.

If the walker attempts to restart while the rehash is still ongoing,
we may miss objects that we shouldn't have.

This patch fixes this by making the walker walk the old table
followed by the new table just like all other readers.  If a
rehash is detected we will still signal our caller of the fact
so they can prepare for duplicates but we will simply continue
the walk onto the new table after the old one is finished either
by us or by the rehasher.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/rhashtable.h
lib/rhashtable.c