The patch titled Fix SUNRPC wakeup/execute race condition has been added to the -mm tree. Its filename is fix-sunrpc-wakeup-execute-race-condition.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: Fix SUNRPC wakeup/execute race condition From: Christophe Saout <christophe@xxxxxxxx> 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. The reordering hopefully doesn't introduce some new race condition, in fact the only possible one is already correctly detected and handled in __rpc_execute. 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 <trond.myklebust@xxxxxxxxxx> Cc: J. Bruce Fields <bfields@xxxxxxxxxxxxxx> Cc: Olaf Kirch <okir@xxxxxxxxxxxx> Signed-off-by: Christophe Saout <christophe@xxxxxxxx> Cc: Neil Brown <neilb@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- net/sunrpc/sched.c | 5 +---- 1 files changed, 1 insertion(+), 4 deletions(-) diff -puN net/sunrpc/sched.c~fix-sunrpc-wakeup-execute-race-condition net/sunrpc/sched.c --- a/net/sunrpc/sched.c~fix-sunrpc-wakeup-execute-race-condition +++ a/net/sunrpc/sched.c @@ -295,12 +295,9 @@ EXPORT_SYMBOL(__rpc_wait_for_completion_ */ static void rpc_make_runnable(struct rpc_task *task) { - int do_ret; - BUG_ON(task->tk_timeout_fn); - do_ret = rpc_test_and_set_running(task); rpc_clear_queued(task); - if (do_ret) + if (rpc_test_and_set_running(task)) return; if (RPC_IS_ASYNC(task)) { int status; _ Patches currently in -mm which might be from christophe@xxxxxxxx are fix-sunrpc-wakeup-execute-race-condition.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html