

Patch from Ulrich Weigand <weigand@immd1.informatik.uni-erlangen.de>

Fix a race wherein timer_pending() returns false, but the timer handler is
actually running on another CPU.  We need to call del_timer_sync()
regardless, so we wait for completion of the handler.


 net/sunrpc/sched.c |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

diff -puN net/sunrpc/sched.c~nfs-del_timer-race-fix net/sunrpc/sched.c
--- 25/net/sunrpc/sched.c~nfs-del_timer-race-fix	2003-03-08 15:47:19.000000000 -0800
+++ 25-akpm/net/sunrpc/sched.c	2003-03-08 15:47:51.000000000 -0800
@@ -158,10 +158,8 @@ void rpc_add_timer(struct rpc_task *task
 static inline void
 rpc_delete_timer(struct rpc_task *task)
 {
-	if (timer_pending(&task->tk_timer)) {
+	if (del_timer_sync(&task->tk_timer))
 		dprintk("RPC: %4d deleting timer\n", task->tk_pid);
-		del_timer_sync(&task->tk_timer);
-	}
 }
 
 /*

_
