Skip to content

Commit

Permalink
rhashtable: future table needs to be traversed when remove an object
Browse files Browse the repository at this point in the history
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 <ying.xue@windriver.com>
Cc: Thomas Graf <tgraf@suug.ch>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ying Xue authored and David S. Miller committed Jan 9, 2015
1 parent db30485 commit bd6d4db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,10 @@ bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *obj)
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);
Expand Down

0 comments on commit bd6d4db

Please sign in to comment.