diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 62b2bd8e1efc53a8b1b3eb5485ef53a46c47ab35..e2d3cf801c31079b3df1f7380a5e8498bea10c60 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -487,7 +487,6 @@ void cache_purge(struct cache_detail *detail) { struct cache_head *ch = NULL; struct hlist_head *head = NULL; - struct hlist_node *tmp = NULL; int i = 0; write_lock(&detail->hash_lock); @@ -499,7 +498,9 @@ void cache_purge(struct cache_detail *detail) dprintk("RPC: %d entries in %s cache\n", detail->entries, detail->name); for (i = 0; i < detail->hash_size; i++) { head = &detail->hash_table[i]; - hlist_for_each_entry_safe(ch, tmp, head, cache_list) { + while (!hlist_empty(head)) { + ch = hlist_entry(head->first, struct cache_head, + cache_list); hlist_del_init(&ch->cache_list); detail->entries--;