Commit 16b82dca authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kNFSd: Fix possible scheduling_while_atomic in cache.c

From: NeilBrown <neilb@cse.unsw.edu.au>

We currently call cache_put, which can schedule(), under a spin_lock.  This
patch moves that call outside the spinlock.
parent c65febbb
...@@ -325,6 +325,7 @@ int cache_clean(void) ...@@ -325,6 +325,7 @@ int cache_clean(void)
if (current_detail && current_index < current_detail->hash_size) { if (current_detail && current_index < current_detail->hash_size) {
struct cache_head *ch, **cp; struct cache_head *ch, **cp;
struct cache_detail *d;
write_lock(&current_detail->hash_lock); write_lock(&current_detail->hash_lock);
...@@ -354,12 +355,14 @@ int cache_clean(void) ...@@ -354,12 +355,14 @@ int cache_clean(void)
rv = 1; rv = 1;
} }
write_unlock(&current_detail->hash_lock); write_unlock(&current_detail->hash_lock);
if (ch) d = current_detail;
current_detail->cache_put(ch, current_detail); if (!ch)
else
current_index ++; current_index ++;
} spin_unlock(&cache_list_lock);
spin_unlock(&cache_list_lock); if (ch)
d->cache_put(ch, d);
} else
spin_unlock(&cache_list_lock);
return rv; return rv;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment