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.



---

 net/sunrpc/cache.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff -puN net/sunrpc/cache.c~nfsd-01-schedule-in-spinlock-fix net/sunrpc/cache.c
--- 25/net/sunrpc/cache.c~nfsd-01-schedule-in-spinlock-fix	2004-02-09 00:13:52.000000000 -0800
+++ 25-akpm/net/sunrpc/cache.c	2004-02-09 00:13:52.000000000 -0800
@@ -325,6 +325,7 @@ int cache_clean(void)
 	
 	if (current_detail && current_index < current_detail->hash_size) {
 		struct cache_head *ch, **cp;
+		struct cache_detail *d;
 		
 		write_lock(&current_detail->hash_lock);
 
@@ -354,12 +355,14 @@ int cache_clean(void)
 			rv = 1;
 		}
 		write_unlock(&current_detail->hash_lock);
-		if (ch)
-			current_detail->cache_put(ch, current_detail);
-		else
+		d = current_detail;
+		if (!ch)
 			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;
 }

_