Skip to content

Commit bd6d4db

Browse files
ying-xuedavem330
authored andcommitted
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 <[email protected]> Cc: Thomas Graf <[email protected]> Acked-by: Thomas Graf <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent db30485 commit bd6d4db

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rhashtable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,10 @@ bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *obj)
608608
return true;
609609
}
610610

611-
if (tbl != rht_dereference_rcu(ht->tbl, ht)) {
611+
if (tbl != rht_dereference_rcu(ht->future_tbl, ht)) {
612612
spin_unlock_bh(lock);
613613

614-
tbl = rht_dereference_rcu(ht->tbl, ht);
614+
tbl = rht_dereference_rcu(ht->future_tbl, ht);
615615
hash = head_hashfn(ht, tbl, obj);
616616

617617
lock = bucket_lock(tbl, hash);

0 commit comments

Comments
 (0)