summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2019-03-21 09:39:52 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-03 06:27:24 +0200
commit5a336f69cfa0cf9c2abf2e865b01458ef4a9ebbd (patch)
tree4e87019e992c813354a7f97c2ea88205a184f888
parent278c7d7e4ecbfd9feb62492a4a98c21c7941faa8 (diff)
downloadtalos-obmc-linux-5a336f69cfa0cf9c2abf2e865b01458ef4a9ebbd.tar.gz
talos-obmc-linux-5a336f69cfa0cf9c2abf2e865b01458ef4a9ebbd.zip
rhashtable: Still do rehash when we get EEXIST
[ Upstream commit 408f13ef358aa5ad56dc6230c2c7deb92cf462b1 ] As it stands if a shrink is delayed because of an outstanding rehash, we will go into a rescheduling loop without ever doing the rehash. This patch fixes this by still carrying out the rehash and then rescheduling so that we can shrink after the completion of the rehash should it still be necessary. The return value of EEXIST captures this case and other cases (e.g., another thread expanded/rehashed the table at the same time) where we should still proceed with the rehash. Fixes: da20420f83ea ("rhashtable: Add nested tables") Reported-by: Josh Elsasser <jelsasser@appneta.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Tested-by: Josh Elsasser <jelsasser@appneta.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--lib/rhashtable.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 852ffa5160f1..4edcf3310513 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -416,8 +416,12 @@ static void rht_deferred_worker(struct work_struct *work)
else if (tbl->nest)
err = rhashtable_rehash_alloc(ht, tbl, tbl->size);
- if (!err)
- err = rhashtable_rehash_table(ht);
+ if (!err || err == -EEXIST) {
+ int nerr;
+
+ nerr = rhashtable_rehash_table(ht);
+ err = err ?: nerr;
+ }
mutex_unlock(&ht->mutex);
OpenPOWER on IntegriCloud