Skip to content

Commit

Permalink
rhashtable: silence RCU warning in rhashtable_test.
Browse files Browse the repository at this point in the history
print_ht in rhashtable_test calls rht_dereference() with neither
RCU protection or the mutex.  This triggers an RCU warning.
So take the mutex to silence the warning.

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
NeilBrown authored and David S. Miller committed Jun 22, 2018
1 parent e5ab564 commit cbab901
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/test_rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ static unsigned int __init print_ht(struct rhltable *rhlt)
unsigned int i, cnt = 0;

ht = &rhlt->ht;
/* Take the mutex to avoid RCU warning */
mutex_lock(&ht->mutex);
tbl = rht_dereference(ht->tbl, ht);
for (i = 0; i < tbl->size; i++) {
struct rhash_head *pos, *next;
Expand Down Expand Up @@ -534,6 +536,7 @@ static unsigned int __init print_ht(struct rhltable *rhlt)
}
}
printk(KERN_ERR "\n---- ht: ----%s\n-------------\n", buff);
mutex_unlock(&ht->mutex);

return cnt;
}
Expand Down

0 comments on commit cbab901

Please sign in to comment.