diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index cb6a6bc9fea77d36db96c9f09a1204e1cdf941d9..3c8110c29c219879c696fd4dbc373ad306167313 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -451,21 +451,21 @@ static int cache_clean(void) } } + spin_lock(¤t_detail->hash_lock); + /* find a non-empty bucket in the table */ - while (current_detail && - current_index < current_detail->hash_size && + while (current_index < current_detail->hash_size && hlist_empty(¤t_detail->hash_table[current_index])) current_index++; /* find a cleanable entry in the bucket and clean it, or set to next bucket */ - if (current_detail && current_index < current_detail->hash_size) { + if (current_index < current_detail->hash_size) { struct cache_head *ch = NULL; struct cache_detail *d; struct hlist_head *head; struct hlist_node *tmp; - spin_lock(¤t_detail->hash_lock); /* Ok, now to clean this strand */ @@ -489,9 +489,10 @@ static int cache_clean(void) spin_unlock(&cache_list_lock); if (ch) sunrpc_end_cache_remove_entry(ch, d); - } else + } else { + spin_unlock(¤t_detail->hash_lock); spin_unlock(&cache_list_lock); - + } return rv; }