From: Ying Xue Date: Wed, 7 Jan 2015 05:41:55 +0000 (+0800) Subject: rhashtable: future table needs to be traversed when remove an object X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bd6d4db552ceb52fb19890a454836dcda59743ce;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git rhashtable: future table needs to be traversed when remove an object When remove an object from hash table, we currently only traverse old bucket table to check whether the object exists. If the object is not found in it, we will try again. But in the second search loop, we still search the object from the old table instead of future table. As a result, the object may be not removed from hash table especially when resizing is currently in progress and the object is just saved in the future table. Signed-off-by: Ying Xue Cc: Thomas Graf Acked-by: Thomas Graf Signed-off-by: David S. Miller --- diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 4430233c4e11..1aef942976fe 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -608,10 +608,10 @@ restart: return true; } - if (tbl != rht_dereference_rcu(ht->tbl, ht)) { + if (tbl != rht_dereference_rcu(ht->future_tbl, ht)) { spin_unlock_bh(lock); - tbl = rht_dereference_rcu(ht->tbl, ht); + tbl = rht_dereference_rcu(ht->future_tbl, ht); hash = head_hashfn(ht, tbl, obj); lock = bucket_lock(tbl, hash);