From: Christophe Saout Date: Sun, 5 Nov 2006 17:42:48 +0000 (+0100) Subject: Subject: Re: [PATCH] Fix SUNRPC wakeup/execute race condition X-Git-Tag: v2.6.20-rc1~34^2~412^2~69 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc4dc59e5580d6c0de1685a25b74d32175f43434;p=pandora-kernel.git Subject: Re: [PATCH] Fix SUNRPC wakeup/execute race condition The sunrpc scheduler contains a race condition that can let an RPC task end up being neither running nor on any wait queue. The race takes place between rpc_make_runnable (called from rpc_wake_up_task) and __rpc_execute under the following condition: First __rpc_execute calls tk_action which puts the task on some wait queue. The task is dequeued by another process before __rpc_execute continues its execution. While executing rpc_make_runnable exactly after setting the task `running' bit and before clearing the `queued' bit __rpc_execute picks up execution, clears `running' and subsequently both functions fall through, both under the false assumption somebody else took the job. Swapping rpc_test_and_set_running with rpc_clear_queued in rpc_make_runnable fixes that hole. This introduces another possible race condition that can be handled by checking for `queued' after setting the `running' bit. Bug noticed on a 4-way x86_64 system under XEN with an NFSv4 server on the same physical machine, apparently one of the few ways to hit this race condition at all. Cc: Trond Myklebust Cc: J. Bruce Fields Signed-off-by: Christophe Saout Signed-off-by: Trond Myklebust --- Reading git-diff-tree failed