linux/net/sunrpc
Christophe Saout cc4dc59e55 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 <trond.myklebust@fys.uio.no>
Cc: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Christophe Saout <christophe@saout.de>
Signed-off-by: Trond Myklebust <trond.myklebust@fys.uio.no>
2006-12-06 10:46:24 -05:00
..
auth_gss [SUNRPC]: Use k{mem,str}dup where applicable 2006-12-02 21:30:20 -08:00
auth_null.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
auth_unix.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
auth.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
cache.c [PATCH] knfsd: fix race related problem when adding items to and svcrpc auth cache 2006-08-06 08:57:47 -07:00
clnt.c [SUNRPC]: Use k{mem,str}dup where applicable 2006-12-02 21:30:20 -08:00
Makefile [PATCH] RPC: introduce client-side transport switch 2005-09-23 12:38:12 -04:00
pmap_clnt.c [PATCH] SUNRPC: fix race in in-kernel RPC portmapper client 2006-10-20 10:26:39 -07:00
rpc_pipe.c [PATCH] r/o bind mount prepwork: inc_nlink() helper 2006-10-01 00:39:30 -07:00
sched.c Subject: Re: [PATCH] Fix SUNRPC wakeup/execute race condition 2006-12-06 10:46:24 -05:00
socklib.c [NET]: Annotate callers of the reset of checksum.h stuff. 2006-12-02 21:23:34 -08:00
stats.c [NET]: Conversions from kmalloc+memset to k(z|c)alloc. 2006-07-21 14:51:30 -07:00
sunrpc_syms.c [PATCH] knfsd: add svc_set_num_threads 2006-10-02 07:57:19 -07:00
svc.c [PATCH] knfsd: Allow lockd to drop replies as appropriate 2006-10-17 08:18:46 -07:00
svcauth_unix.c [SUNRPC]: annotate hash_ip() 2006-12-02 21:21:16 -08:00
svcauth.c [PATCH] sunrpc: add missing spin_unlock 2006-11-06 01:46:23 -08:00
svcsock.c [PATCH] fix "sunrpc: fix refcounting problems in rpc servers" 2006-10-30 12:12:21 -08:00
sysctl.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
timer.c SUNRPC: remove extraneous header inclusions 2006-09-22 23:24:47 -04:00
xdr.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
xprt.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
xprtsock.c [PATCH] SUNRPC: fix a typo 2006-10-20 10:26:39 -07:00