diff options
author | NeilBrown <neilb@suse.com> | 2018-06-17 22:52:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-06-22 00:43:27 -0400 |
commit | cbab901296232b1247b46e6e127103d2f738d783 (patch) | |
tree | 0e257d10be56b4b0bb163212cdc78f082688470e | |
parent | e5ab564c9ebee77794842ca7d7476147b83d6a27 (diff) |
rhashtable: silence RCU warning in rhashtable_test.
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>
-rw-r--r-- | lib/test_rhashtable.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c index fb6968109113..6ca59ffcacbe 100644 --- a/lib/test_rhashtable.c +++ b/lib/test_rhashtable.c | |||
@@ -501,6 +501,8 @@ static unsigned int __init print_ht(struct rhltable *rhlt) | |||
501 | unsigned int i, cnt = 0; | 501 | unsigned int i, cnt = 0; |
502 | 502 | ||
503 | ht = &rhlt->ht; | 503 | ht = &rhlt->ht; |
504 | /* Take the mutex to avoid RCU warning */ | ||
505 | mutex_lock(&ht->mutex); | ||
504 | tbl = rht_dereference(ht->tbl, ht); | 506 | tbl = rht_dereference(ht->tbl, ht); |
505 | for (i = 0; i < tbl->size; i++) { | 507 | for (i = 0; i < tbl->size; i++) { |
506 | struct rhash_head *pos, *next; | 508 | struct rhash_head *pos, *next; |
@@ -534,6 +536,7 @@ static unsigned int __init print_ht(struct rhltable *rhlt) | |||
534 | } | 536 | } |
535 | } | 537 | } |
536 | printk(KERN_ERR "\n---- ht: ----%s\n-------------\n", buff); | 538 | printk(KERN_ERR "\n---- ht: ----%s\n-------------\n", buff); |
539 | mutex_unlock(&ht->mutex); | ||
537 | 540 | ||
538 | return cnt; | 541 | return cnt; |
539 | } | 542 | } |