NFS hang
Subsystems (3)
Hi,
We've got an IBM bladecenter we're using to do some NFS stress testing (v3). It seems with kernel 2.6.16.21 we get a hang during our stress tests after roughly and hour or two. The hanging process has a backtrace that looks like this:
cp D 000000000ff0b198 6672 16505 16296
(NOTLB)
Call Trace:
[C00000000F43B1D0] [C00000002DD5B088] 0xc00000002dd5b088 (unreliable) [C00000000F43B3A0] [C00000000000F0B4] .__switch_to+0x12c/0x150 [C00000000F43B430] [C00000000039980C] .schedule+0xcec/0xe4c [C00000000F43B540] [C00000000039A688] .io_schedule+0x68/0xb8 [C00000000F43B5D0] [C000000000093D60] .sync_page+0x7c/0x98 [C00000000F43B650] [C00000000039A8B4] .__wait_on_bit_lock+0x8c/0x114 [C00000000F43B700] [C000000000093C94] .__lock_page+0xa0/0xc8 [C00000000F43B820] [C000000000094A6C] .do_generic_mapping_read+0x21c/0x4a0 [C00000000F43B970] [C000000000095624] .__generic_file_aio_read+0x17c/0x228 [C00000000F43BA40] [C0000000000957C4] .generic_file_aio_read+0x44/0x54 [C00000000F43BAD0] [D000000000320F58] .nfs_file_read+0xb8/0xec [nfs] [C00000000F43BB70] [C0000000000C5298] .do_sync_read+0xd4/0x130 [C00000000F43BCF0] [C0000000000C60E0] .vfs_read+0x128/0x20c [C00000000F43BD90] [C0000000000C65C0] .sys_read+0x4c/0x8c [C00000000F43BE30] [C00000000000871C] syscall_exit+0x0/0x40
So far, we've only been able to recreate this with the client and server blades both in the same chassis. We tried recreating with nfs_debug enabled, but it did not hang. So perhaps there is a correlation with the high-speed network (gigabit ethernet over fibre) that comes with that configuration.
Does anyone recognize the backtrace of the process or the symptoms of the problem? We'd appreciate any info that you may have.
Please CC me in responses as I'm not subscribed to this list.
josh
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 30 lines · Josh Boyer
We've got an IBM bladecenter we're using to do some NFS stress testing (v3). It seems with kernel 2.6.16.21 we get a hang during our stress tests after roughly and hour or two. The hanging process has a backtrace that looks like this:
cp D
000000000ff0b1986672 16505 16296
(NOTLB)Call Trace:[C00000000F43B1D0] [C00000002DD5B088]
0xc00000002dd5b088(unreliable) [C00000000F43B3A0] [C00000000000F0B4] .__switch_to+0x12c/0x150 [C00000000F43B430] [C00000000039980C] .schedule+0xcec/0xe4c [C00000000F43B540] [C00000000039A688] .io_schedule+0x68/0xb8 [C00000000F43B5D0] [C000000000093D60] .sync_page+0x7c/0x98 [C00000000F43B650] [C00000000039A8B4] .__wait_on_bit_lock+0x8c/0x114 [C00000000F43B700] [C000000000093C94] .__lock_page+0xa0/0xc8 [C00000000F43B820] [C000000000094A6C] .do_generic_mapping_read+0x21c/0x4a0 [C00000000F43B970] [C000000000095624] .__generic_file_aio_read+0x17c/0x228 [C00000000F43BA40] [C0000000000957C4] .generic_file_aio_read+0x44/0x54 [C00000000F43BAD0] [D000000000320F58] .nfs_file_read+0xb8/0xec [nfs] [C00000000F43BB70] [C0000000000C5298] .do_sync_read+0xd4/0x130 [C00000000F43BCF0] [C0000000000C60E0] .vfs_read+0x128/0x20c [C00000000F43BD90] [C0000000000C65C0] .sys_read+0x4c/0x8c [C00000000F43BE30] [C00000000000871C]syscall_exit+0x0/0x40So far, we've only been able to recreate this with the client and server blades both in the same chassis. We tried recreating with
nfs_debugenabled, but it did not hang. So perhaps there is a correlation with the high-speed network (gigabit ethernet over fibre) that comes with that configuration.
Quoted 4 lines
Does anyone recognize the backtrace of the process or the symptoms of the problem? We'd appreciate any info that you may have.
Please CC me in responses as I'm not subscribed to this list.
Hi. I am digging into a hang file issue (albeit NFSv2) that I've narrowed down to beginning with 2.6.11 and continuing to happen through 2.6.18, but which does not happen on 2.6.10 or prior.
I wonder if you could run your tests on 2.6.10 and 2.6.11.12 and share the results with me.
Thanks,
Chris
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 34 lines · Chris Caputo
Quoted 33 lines · Josh Boyer
We've got an IBM bladecenter we're using to do some NFS stress testing (v3). It seems with kernel 2.6.16.21 we get a hang during our stress tests after roughly and hour or two. The hanging process has a backtrace that looks like this:
cp D
000000000ff0b1986672 16505 16296
(NOTLB)Call Trace:[C00000000F43B1D0] [C00000002DD5B088]
0xc00000002dd5b088(unreliable) [C00000000F43B3A0] [C00000000000F0B4] .__switch_to+0x12c/0x150 [C00000000F43B430] [C00000000039980C] .schedule+0xcec/0xe4c [C00000000F43B540] [C00000000039A688] .io_schedule+0x68/0xb8 [C00000000F43B5D0] [C000000000093D60] .sync_page+0x7c/0x98 [C00000000F43B650] [C00000000039A8B4] .__wait_on_bit_lock+0x8c/0x114 [C00000000F43B700] [C000000000093C94] .__lock_page+0xa0/0xc8 [C00000000F43B820] [C000000000094A6C] .do_generic_mapping_read+0x21c/0x4a0 [C00000000F43B970] [C000000000095624] .__generic_file_aio_read+0x17c/0x228 [C00000000F43BA40] [C0000000000957C4] .generic_file_aio_read+0x44/0x54 [C00000000F43BAD0] [D000000000320F58] .nfs_file_read+0xb8/0xec [nfs] [C00000000F43BB70] [C0000000000C5298] .do_sync_read+0xd4/0x130 [C00000000F43BCF0] [C0000000000C60E0] .vfs_read+0x128/0x20c [C00000000F43BD90] [C0000000000C65C0] .sys_read+0x4c/0x8c [C00000000F43BE30] [C00000000000871C]syscall_exit+0x0/0x40So far, we've only been able to recreate this with the client and server blades both in the same chassis. We tried recreating with
nfs_debugenabled, but it did not hang. So perhaps there is a correlation with the high-speed network (gigabit ethernet over fibre) that comes with that configuration.Does anyone recognize the backtrace of the process or the symptoms of the problem? We'd appreciate any info that you may have.
Quoted 8 lines
Quoted 1 line
Please CC me in responses as I'm not subscribed to this list.
Hi. I am digging into a hang file issue (albeit NFSv2) that I've narrowed down to beginning with 2.6.11 and continuing to happen through 2.6.18, but which does not happen on 2.6.10 or prior.
I wonder if you could run your tests on 2.6.10 and 2.6.11.12 and share the results with me.
If you were running into the same problem I was, the following should fix it. The below patch should apply with ease to 2.6.16.21.
Chris
---
[PATCH 2.6.19-rc6] sunrpc: fix race condition
Patch linux-2.6.10-01-rpc_workqueue.dif introduced a race condition into net/sunrpc/sched.c in kernels 2.6.11-rc1 through 2.6.19-rc6. The race scenario is as follows...
Given: RPC_TASK_QUEUED, RPC_TASK_RUNNING and RPC_TASK_ASYNC are set.
__rpc_execute() (no spinlock) rpc_make_runnable() (queue spinlock held)
----------------------------- -----------------------------------------
do_ret = rpc_test_and_set_running(task);
rpc_clear_running(task);
if (RPC_IS_ASYNC(task)) {
if (RPC_IS_QUEUED(task))
return 0;
rpc_clear_queued(task);
if (do_ret)
return;Thus both threads return and the task is abandoned forever.
In my test NFS client usage (~200 Mb/s at ~3,000 RPC calls/s) this race condition has resulted in processes getting permanently stuck in 'D' state often in less than 15 minutes of uptime.
The following patch fixes the problem by returning to use of a spinlock in __rpc_execute().
---
net/sunrpc/sched.c +14 -8
@@ -587,6 +587,7 @@ EXPORT_SYMBOL(rpc_exit_task);static int __rpc_execute (struct rpc_task *task) {int status =0 ; +struct rpc_wait_queue *queue;dprintk ("RPC: %4d rpc_execute flgs %x\n" , task->tk_pid, task->tk_flags);
@@ -631,22 +632,27 @@ static int __rpc_execute(struct rpc_tasklock_kernel (); task->tk_action (task);unlock_kernel (); +/* micro-optimization to avoid spinlock */ +if (!RPC_IS_QUEUED (task)) +continue ; }/* -* Lockless check for whether task is sleeping or not. +* Check whether task is sleeping. */ -if (!RPC_IS_QUEUED (task)) -continue ; -rpc_clear_running (task); + queue = task->u.tk_wait.rpc_waitq; +spin_lock_bh (&queue->lock);if (RPC_IS_ASYNC (task)) { -/* Careful! we may have raced... */ -if (RPC_IS_QUEUED (task)) -return 0 ; -if (rpc_test_and_set_running (task)) +if (RPC_IS_QUEUED (task)) { +rpc_clear_running (task); +spin_unlock_bh (&queue->lock);return 0 ; + } +spin_unlock_bh (&queue->lock);continue ; } +rpc_clear_running (task); +spin_unlock_bh (&queue->lock);/* sync task: sleep here */ dprintk ("RPC: %4d sync task going to sleep\n" , task->tk_pid);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 100 lines · Chris Caputo
Quoted 34 lines · Chris Caputo
Quoted 33 lines · Josh Boyer
We've got an IBM bladecenter we're using to do some NFS stress testing (v3). It seems with kernel 2.6.16.21 we get a hang during our stress tests after roughly and hour or two. The hanging process has a backtrace that looks like this:
cp D
000000000ff0b1986672 16505 16296
(NOTLB)Call Trace:[C00000000F43B1D0] [C00000002DD5B088]
0xc00000002dd5b088(unreliable) [C00000000F43B3A0] [C00000000000F0B4] .__switch_to+0x12c/0x150 [C00000000F43B430] [C00000000039980C] .schedule+0xcec/0xe4c [C00000000F43B540] [C00000000039A688] .io_schedule+0x68/0xb8 [C00000000F43B5D0] [C000000000093D60] .sync_page+0x7c/0x98 [C00000000F43B650] [C00000000039A8B4] .__wait_on_bit_lock+0x8c/0x114 [C00000000F43B700] [C000000000093C94] .__lock_page+0xa0/0xc8 [C00000000F43B820] [C000000000094A6C] .do_generic_mapping_read+0x21c/0x4a0 [C00000000F43B970] [C000000000095624] .__generic_file_aio_read+0x17c/0x228 [C00000000F43BA40] [C0000000000957C4] .generic_file_aio_read+0x44/0x54 [C00000000F43BAD0] [D000000000320F58] .nfs_file_read+0xb8/0xec [nfs] [C00000000F43BB70] [C0000000000C5298] .do_sync_read+0xd4/0x130 [C00000000F43BCF0] [C0000000000C60E0] .vfs_read+0x128/0x20c [C00000000F43BD90] [C0000000000C65C0] .sys_read+0x4c/0x8c [C00000000F43BE30] [C00000000000871C]syscall_exit+0x0/0x40So far, we've only been able to recreate this with the client and server blades both in the same chassis. We tried recreating with
nfs_debugenabled, but it did not hang. So perhaps there is a correlation with the high-speed network (gigabit ethernet over fibre) that comes with that configuration.Does anyone recognize the backtrace of the process or the symptoms of the problem? We'd appreciate any info that you may have.
Quoted 8 lines
Quoted 1 line
Please CC me in responses as I'm not subscribed to this list.
Hi. I am digging into a hang file issue (albeit NFSv2) that I've narrowed down to beginning with 2.6.11 and continuing to happen through 2.6.18, but which does not happen on 2.6.10 or prior.
I wonder if you could run your tests on 2.6.10 and 2.6.11.12 and share the results with me.
If you were running into the same problem I was, the following should fix it. The below patch should apply with ease to 2.6.16.21.
Chris
---
[PATCH 2.6.19-rc6] sunrpc: fix race condition
Patch linux-2.6.10-01-rpc_workqueue.dif introduced a race condition into
net/sunrpc/sched.cin kernels 2.6.11-rc1 through 2.6.19-rc6. The race scenario is as follows...Given:
RPC_TASK_QUEUED,RPC_TASK_RUNNINGandRPC_TASK_ASYNCare set.
__rpc_execute()(no spinlock)rpc_make_runnable()(queue spinlock held)
----------------------------- -----------------------------------------do_ret = rpc_test_and_set_running(task); rpc_clear_running(task); if (RPC_IS_ASYNC(task)) { if (RPC_IS_QUEUED(task)) return 0; rpc_clear_queued(task); if (do_ret) return;Thus both threads return and the task is abandoned forever.
In my test NFS client usage (~200 Mb/s at ~3,000 RPC calls/s) this race condition has resulted in processes getting permanently stuck in 'D' state often in less than 15 minutes of uptime.
The following patch fixes the problem by returning to use of a spinlock in
__rpc_execute().Signed-off-by Chris Caputo <[email protected]>---
diff -up
a/net/sunrpc/sched.cb/net/sunrpc/sched.cnet/sunrpc/sched.c +4
-0@@ -587,6 +587,7 @@ EXPORT_SYMBOL(rpc_exit_task);static int __rpc_execute (struct rpc_task *task) {int status =0 ; +struct rpc_wait_queue *queue;dprintk ("RPC: %4d rpc_execute flgs %x\n" , task->tk_pid, task->tk_flags);@@ -631,22 +632,27 @@ static int __rpc_execute(struct rpc_tasklock_kernel (); task->tk_action (task);unlock_kernel (); +/* micro-optimization to avoid spinlock */ +if (!RPC_IS_QUEUED (task)) +continue ;
net/sunrpc/sched.c static int __rpc_execute(struct rpc_task · line 643
Quoted 10 lines
net/sunrpc/sched.c +2
-4}/* -* Lockless check for whether task is sleeping or not. +* Check whether task is sleeping. */ -if (!RPC_IS_QUEUED (task)) -continue ; -rpc_clear_running (task); + queue = task->u.tk_wait.rpc_waitq;
NACK... There is no guarantee that task->u.tk_wait has any meaning here. Particularly not so in the case of an asynchronous task, where the storage is shared with the work_struct.
Quoted 21 lines
net/sunrpc/sched.c +8
-5+spin_lock_bh (&queue->lock);if (RPC_IS_ASYNC (task)) { -/* Careful! we may have raced... */ -if (RPC_IS_QUEUED (task)) -return 0 ; -if (rpc_test_and_set_running (task)) +if (RPC_IS_QUEUED (task)) { +rpc_clear_running (task); +spin_unlock_bh (&queue->lock);return 0 ; + } +spin_unlock_bh (&queue->lock);continue ; } +rpc_clear_running (task); +spin_unlock_bh (&queue->lock);/* sync task: sleep here */ dprintk ("RPC: %4d sync task going to sleep\n" , task->tk_pid); -------------------------------------------------------------------------
Quoted 7 lines
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 9 lines · Trond Myklebust
net/sunrpc/sched.c static int __rpc_execute(struct rpc_task · line 643
Quoted 4 lines · Chris Caputo
net/sunrpc/sched.c +1
-3-if (!RPC_IS_QUEUED (task)) -continue ; -rpc_clear_running (task); + queue = task->u.tk_wait.rpc_waitq;NACK... There is no guarantee that
task->u.tk_waithas any meaning here. Particularly not so in the case of an asynchronous task, where the storage is shared with thework_struct.
Yikes. Would you suggest I move the lock outside of the union and try again?
Thanks,
Chris
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 11 lines · Chris Caputo
Quoted 9 lines · Trond Myklebust
Review
Quoted 4 lines · Chris Caputo
(quoted diff) +1
-3- if (!RPC_IS_QUEUED(task)) - continue; - rpc_clear_running(task); + queue = task->u.tk_wait.rpc_waitq;NACK... There is no guarantee that
task->u.tk_waithas any meaning here. Particularly not so in the case of an asynchronous task, where the storage is shared with thework_struct.
Quoted 2 lines
Yikes. Would you suggest I move the lock outside of the union and try again?
No. There is no way this can work. You would need something that guarantees that the task stays queued while you are taking the queue lock.
Have you instead tried Christophe Saout's patch (see attachment)?
Cheers
Trond
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.
---
net/sunrpc/sched.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
net/sunrpc/sched.c +6 -4
@@ -295,13 +295,15 @@ 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 ; +/* We might have raced */ +if (RPC_IS_QUEUED (task)) { +rpc_clear_running (task);return ; + }if (RPC_IS_ASYNC (task)) {int status;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 12 lines · Trond Myklebust
Quoted 11 lines · Chris Caputo
Quoted 9 lines · Trond Myklebust
Review
Quoted 4 lines · Chris Caputo
(quoted diff) +1
-3- if (!RPC_IS_QUEUED(task)) - continue; - rpc_clear_running(task); + queue = task->u.tk_wait.rpc_waitq;NACK... There is no guarantee that
task->u.tk_waithas any meaning here. Particularly not so in the case of an asynchronous task, where the storage is shared with thework_struct.
Quoted 8 lines
Quoted 2 lines
Yikes. Would you suggest I move the lock outside of the union and try again?
No. There is no way this can work. You would need something that guarantees that the task stays queued while you are taking the queue lock.
Have you instead tried Christophe Saout's patch (see attachment)?
Thank you for the suggestion. With 65 minutes of uptime so far, Saout's November 5th patch is looking good. For reference, normally I see the race happen in under 15 minutes.
I'll report back if any problems develop. This machine is an outgoing newsfeed server and so it pounds on NFS client routines 24x7.
Chris
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 20 lines · Chris Caputo
Quoted 19 lines · Trond Myklebust
Quoted 11 lines · Chris Caputo
Quoted 9 lines · Trond Myklebust
Review
Quoted 4 lines · Chris Caputo
(quoted diff) +1
-3- if (!RPC_IS_QUEUED(task)) - continue; - rpc_clear_running(task); + queue = task->u.tk_wait.rpc_waitq;NACK... There is no guarantee that
task->u.tk_waithas any meaning here. Particularly not so in the case of an asynchronous task, where the storage is shared with thework_struct.Quoted 2 lines
Yikes. Would you suggest I move the lock outside of the union and try again?
No. There is no way this can work. You would need something that guarantees that the task stays queued while you are taking the queue lock.
Quoted 8 lines
Quoted 1 line
Have you instead tried Christophe Saout's patch (see attachment)?
Thank you for the suggestion. With 65 minutes of uptime so far, Saout's November 5th patch is looking good. For reference, normally I see the race happen in under 15 minutes.
I'll report back if any problems develop. This machine is an outgoing newsfeed server and so it pounds on NFS client routines 24x7.
Would the race condition that Chris described potentially lead to the stack trace I originally posted? If so, I can try to test this patch out myself.
josh
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 27 lines · Josh Boyer
Quoted 26 lines · Chris Caputo
Quoted 12 lines · Trond Myklebust
Quoted 11 lines · Chris Caputo
Quoted 9 lines · Trond Myklebust
Review
Quoted 4 lines · Chris Caputo
(quoted diff) +1
-3- if (!RPC_IS_QUEUED(task)) - continue; - rpc_clear_running(task); + queue = task->u.tk_wait.rpc_waitq;NACK... There is no guarantee that
task->u.tk_waithas any meaning here. Particularly not so in the case of an asynchronous task, where the storage is shared with thework_struct.Quoted 8 lines
Quoted 2 lines
Yikes. Would you suggest I move the lock outside of the union and try again?
No. There is no way this can work. You would need something that guarantees that the task stays queued while you are taking the queue lock.
Have you instead tried Christophe Saout's patch (see attachment)?
Thank you for the suggestion. With 65 minutes of uptime so far, Saout's November 5th patch is looking good. For reference, normally I see the race happen in under 15 minutes.
Quoted 6 lines
Quoted 2 lines
I'll report back if any problems develop. This machine is an outgoing newsfeed server and so it pounds on NFS client routines 24x7.
Would the race condition that Chris described potentially lead to the stack trace I originally posted? If so, I can try to test this patch out myself.
Yes. Your stack showed that your process was waiting for data to be read via NFS. It is possible that this bug resulted in your read request being lost forever and thus your process hung forever. And any other processes which then attempted to read the same data would also hang. It's contagious. :-)
Chris
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 35 lines · Chris Caputo
Quoted 27 lines · Josh Boyer
Quoted 26 lines · Chris Caputo
Quoted 12 lines · Trond Myklebust
Quoted 11 lines · Chris Caputo
Quoted 9 lines · Trond Myklebust
Review
Quoted 4 lines · Chris Caputo
(quoted diff) +1
-3- if (!RPC_IS_QUEUED(task)) - continue; - rpc_clear_running(task); + queue = task->u.tk_wait.rpc_waitq;NACK... There is no guarantee that
task->u.tk_waithas any meaning here. Particularly not so in the case of an asynchronous task, where the storage is shared with thework_struct.Quoted 8 lines
Quoted 2 lines
Yikes. Would you suggest I move the lock outside of the union and try again?
No. There is no way this can work. You would need something that guarantees that the task stays queued while you are taking the queue lock.
Have you instead tried Christophe Saout's patch (see attachment)?
Thank you for the suggestion. With 65 minutes of uptime so far, Saout's November 5th patch is looking good. For reference, normally I see the race happen in under 15 minutes.
Quoted 6 lines
Quoted 2 lines
I'll report back if any problems develop. This machine is an outgoing newsfeed server and so it pounds on NFS client routines 24x7.
Would the race condition that Chris described potentially lead to the stack trace I originally posted? If so, I can try to test this patch out myself.
Quoted 5 lines
Yes. Your stack showed that your process was waiting for data to be read via NFS. It is possible that this bug resulted in your read request being lost forever and thus your process hung forever. And any other processes which then attempted to read the same data would also hang. It's contagious. :-)
Ok. I will try and give this a shot soon. Our test setup takes anywhere from a couple hours to a couple days to recreate, but it typically fails overnight. I'll report back as soon as I have results.
josh
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 27 lines · Josh Boyer
Quoted 26 lines · Chris Caputo
Quoted 12 lines · Trond Myklebust
Quoted 11 lines · Chris Caputo
Quoted 9 lines · Trond Myklebust
Review
Quoted 4 lines · Chris Caputo
(quoted diff) +1
-3- if (!RPC_IS_QUEUED(task)) - continue; - rpc_clear_running(task); + queue = task->u.tk_wait.rpc_waitq;NACK... There is no guarantee that
task->u.tk_waithas any meaning here. Particularly not so in the case of an asynchronous task, where the storage is shared with thework_struct.Quoted 8 lines
Quoted 2 lines
Yikes. Would you suggest I move the lock outside of the union and try again?
No. There is no way this can work. You would need something that guarantees that the task stays queued while you are taking the queue lock.
Have you instead tried Christophe Saout's patch (see attachment)?
Thank you for the suggestion. With 65 minutes of uptime so far, Saout's November 5th patch is looking good. For reference, normally I see the race happen in under 15 minutes.
Quoted 6 lines
Quoted 2 lines
I'll report back if any problems develop. This machine is an outgoing newsfeed server and so it pounds on NFS client routines 24x7.
Would the race condition that Chris described potentially lead to the stack trace I originally posted? If so, I can try to test this patch out myself.
Possibly. It is worth trying.
Trond
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 28 lines · Trond Myklebust
Quoted 27 lines · Josh Boyer
Quoted 26 lines · Chris Caputo
Quoted 12 lines · Trond Myklebust
Quoted 11 lines · Chris Caputo
Quoted 9 lines · Trond Myklebust
Review
Quoted 4 lines · Chris Caputo
(quoted diff) +1
-3- if (!RPC_IS_QUEUED(task)) - continue; - rpc_clear_running(task); + queue = task->u.tk_wait.rpc_waitq;NACK... There is no guarantee that
task->u.tk_waithas any meaning here. Particularly not so in the case of an asynchronous task, where the storage is shared with thework_struct.Quoted 8 lines
Quoted 2 lines
Yikes. Would you suggest I move the lock outside of the union and try again?
No. There is no way this can work. You would need something that guarantees that the task stays queued while you are taking the queue lock.
Have you instead tried Christophe Saout's patch (see attachment)?
Thank you for the suggestion. With 65 minutes of uptime so far, Saout's November 5th patch is looking good. For reference, normally I see the race happen in under 15 minutes.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I'll report back if any problems develop. This machine is an outgoing newsfeed server and so it pounds on NFS client routines 24x7.
Would the race condition that Chris described potentially lead to the stack trace I originally posted? If so, I can try to test this patch out myself.
Possibly. It is worth trying.
We've been testing this patch in our kernel and it looks good. The tests have run for 2 days and 13 hours so far, which is longer than previous attempts. I would suggest adding this to upstream (if it isn't already), and possibly even the stable release.
josh
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 5 lines · Chris Caputo
Quoted 4 lines · Trond Myklebust
No. There is no way this can work. You would need something that guarantees that the task stays queued while you are taking the queue lock.
Quoted 8 lines
Quoted 1 line
Have you instead tried Christophe Saout's patch (see attachment)?
Thank you for the suggestion. With 65 minutes of uptime so far, Saout's November 5th patch is looking good. For reference, normally I see the race happen in under 15 minutes.
I'll report back if any problems develop. This machine is an outgoing newsfeed server and so it pounds on NFS client routines 24x7.
I am not sure if this is related, but at just over 3 days of uptime with 2.6.19-rc6 and the Saout patch, I had this happen:
---
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000028 printing eip: c029cf64 *pde = 00000000 Oops: 0000 [#1] SMP Modules linked in: weasel_pci CPU: 1 EIP: 0060:[<c029cf64>] Not tainted VLI EFLAGS: 00010202 (2.6.19-rc6 #5)
EIP is at call_start+0x5c/0x6f
eax: c030ae00 ebx: d2c80ac4 ecx: 00000001 edx: f6ad7550
esi: 00000000 edi: 00000000 ebp: f6adbdd0 esp: f6adbd18
ds: 007b es: 007b ss: 0068
Process feeder (pid: 4557, ti=f6adb000 task=f6ad7550 task.ti=f6adb000)
Stack: 00000000 00000282 c02ade34 00000001 f6ad7550 c0112a05 d2c80ac4 d2c80b2c
c02a22de d2c80c54 f78ca6e0 f6adbdd0 c02adc03 d2c80ac4 d2c80c54 f78ca6e0
c01a0795 80000000 00000000 d2c80ac0 d2c80c54 00002000 c01a0cf8 00002000
Call Trace:
[<c02ade34>] __down+0xa1/0xd7
[<c0112a05>] default_wake_function+0x0/0xc
[<c02a22de>] __rpc_execute+0x82/0x1b8
[<c02adc03>] __down_failed+0x7/0xc
[<c01a0795>] nfs_execute_read+0x35/0x49
[<c01a0cf8>] nfs_pagein_one+0x239/0x251
[<c01a0fb2>] nfs_readpages+0x140/0x1a2
[<c01377d1>] __alloc_pages+0x55/0x284
[<c0138ead>] __do_page_cache_readahead+0x126/0x1e5
[<c025bdc0>] lock_sock+0x88/0x90
[<c025eebc>] __alloc_skb+0x49/0xef
[<c02adf66>] _spin_lock_bh+0x8/0x18
[<c025bcaf>] release_sock+0xf/0x98
[<c027b43a>] tcp_sendpage+0x55b/0x575
[<c02ac57a>] __sched_text_start+0x69a/0x73d
[<c0138fb8>] blockable_page_cache_readahead+0x4c/0x9f
[<c0139087>] make_ahead_window+0x7c/0x99
[<c0139216>] page_cache_readahead+0x172/0x195
[<c0133e83>] do_generic_mapping_read+0x13f/0x42e
[<c01341c0>] generic_file_sendfile+0x4e/0x60
[<c0133283>] file_send_actor+0x0/0x53
[<c014c1b9>] do_sendfile+0x193/0x23e
[<c0133283>] file_send_actor+0x0/0x53
[<c014c346>] sys_sendfile+0x4d/0x94
[<c0102a03>] syscall_call+0x7/0xb
=======================
Code: 8b 46 14 89 44 24 0c 8b 46 20 c7 04 24 d7 dc 2e c0 89 44 24 08 0f b7 83 b0 00 00 00 89 44 24 04 e8 69 b3 e7 ff 8b 43 1c ff 40 10 <8b> 46 28 ff 40 18 c7 43 3c 77 cf 29 c0 83 c4 18 5b 5e c3 53 89
EIP: [<c029cf64>] call_start+0x5c/0x6f SS:ESP 0068:f6adbd18---
# nfsstat -c Client rpc stats: calls retrans authrefrsh 747221801 4444 0 Client nfs v2: null getattr setattr root lookup readlink 0 0% 19831747 2% 0 0% 0 0% 16718708 2% 0 0% read wrcache write create remove rename 710082513 95% 0 0% 588780 0% 6 0% 3 0% 3 0% link symlink mkdir rmdir readdir fsstat 0 0% 0 0% 0 0% 0 0% 9 0% 29 0%
I am now compiling 2.6.19 with the Saout patch...
Chris
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 15 lines · Chris Caputo
Quoted 5 lines · Chris Caputo
Quoted 4 lines · Trond Myklebust
No. There is no way this can work. You would need something that guarantees that the task stays queued while you are taking the queue lock.
Quoted 8 lines
Quoted 1 line
Have you instead tried Christophe Saout's patch (see attachment)?
Thank you for the suggestion. With 65 minutes of uptime so far, Saout's November 5th patch is looking good. For reference, normally I see the race happen in under 15 minutes.
I'll report back if any problems develop. This machine is an outgoing newsfeed server and so it pounds on NFS client routines 24x7.
Quoted 8 lines
I am not sure if this is related, but at just over 3 days of uptime with 2.6.19-rc6 and the Saout patch, I had this happen:
---
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000028 printing eip:
c029cf64
EIP is atcall_start+0x5c/0x6f
I believe the above is the following line in clnt.c:call_start():
clnt->cl_stats->rpccnt++;
So call_start() was called with a NULL task->tk_client.
Similar result with 2.6.19...
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000008 printing eip:
c029ef8e
EIP is at xprt_reserve+0x28/0x119
In this one xprt.c:xprt_reserve() is I believe crashing at:
spin_lock(&xprt->reserve_lock);
due to a NULL task->tk_xprt.
Ideas on whether this is related to the Saout sched race patch or if this is something else entirely?
Chris
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 38 lines · Chris Caputo
Quoted 15 lines · Chris Caputo
Quoted 5 lines · Chris Caputo
Quoted 4 lines · Trond Myklebust
No. There is no way this can work. You would need something that guarantees that the task stays queued while you are taking the queue lock.
Quoted 8 lines
Quoted 1 line
Have you instead tried Christophe Saout's patch (see attachment)?
Thank you for the suggestion. With 65 minutes of uptime so far, Saout's November 5th patch is looking good. For reference, normally I see the race happen in under 15 minutes.
I'll report back if any problems develop. This machine is an outgoing newsfeed server and so it pounds on NFS client routines 24x7.
Quoted 8 lines
I am not sure if this is related, but at just over 3 days of uptime with 2.6.19-rc6 and the Saout patch, I had this happen:
---
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000028 printing eip:
c029cf64
EIP is atcall_start+0x5c/0x6fI believe the above is the following line in clnt.c:call_start():
clnt->cl_stats->rpccnt++;
So
call_start()was called with a NULLtask->tk_client.Similar result with 2.6.19...
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000008 printing eip:
c029ef8e
EIP is atxprt_reserve+0x28/0x119
Quoted 8 lines
In this one xprt.c:xprt_reserve() is I believe crashing at:
spin_lock(&xprt->reserve_lock);due to a NULL
task->tk_xprt.Ideas on whether this is related to the Saout sched race patch or if this is something else entirely?
I suspect that it is related, but not the same race. I've identified a couple of other possible race conditions, mainly to do with the fact that nothing prevents an rpc_task from being freed while you are inside rpc_wake_up_task(). Could you try applying both the attached patches, and see if that helps?
Cheers,
Trond
---
fs/nfs/nfs4proc.c | 12 +++--- include/linux/sunrpc/sched.h | 8 +--- net/sunrpc/clnt.c | 19 +++++----- net/sunrpc/pmap_clnt.c | 2 + net/sunrpc/sched.c | 80 +++++++++++++++++++++++++----------------- net/sunrpc/sunrpc_syms.c | 1 - 6 files changed, 65 insertions(+), 57 deletions(-)
fs/nfs/nfs4proc.c +6 -6
@@ -636,7 +636,7 @@ static int _nfs4_proc_open_confirm(strucsmp_wmb (); }else status = data->rpc_status; -rpc_release_task (task); +rpc_put_task (task);return status; }
@@ -742,7 +742,7 @@ static int _nfs4_proc_open(struct nfs4_osmp_wmb (); }else status = data->rpc_status; -rpc_release_task (task); +rpc_put_task (task);if (status !=0 )return status;
@@ -3067,7 +3067,7 @@ static int _nfs4_proc_delegreturn(structif (status ==0 )nfs_post_op_update_inode (inode, &data->fattr); } -rpc_release_task (task); +rpc_put_task (task);return status; }
@@ -3314,7 +3314,7 @@ static int nfs4_proc_unlck(struct nfs4_sif (IS_ERR (task)) goto out; status =nfs4_wait_for_completion_rpc_task (task); -rpc_release_task (task); +rpc_put_task (task); out:return status; }
@@ -3430,7 +3430,7 @@ static void nfs4_lock_release(void *call task =nfs4_do_unlck (&data->fl, data->ctx, data->lsp, data->arg.lock_seqid);if (!IS_ERR (task)) -rpc_release_task (task); +rpc_put_task (task);dprintk ("%s: cancelling lock!\n" , __FUNCTION__); }else nfs_free_seqid (data->arg.lock_seqid);
@@ -3472,7 +3472,7 @@ static int _nfs4_do_setlk(struct nfs4_st ret = -EAGAIN ; }else data->cancelled =1 ; -rpc_release_task (task); +rpc_put_task (task);dprintk ("%s: done, ret = %d!\n" , __FUNCTION__, ret);return ret; }
include/linux/sunrpc/sched.h +1 -7
@@ -178,13 +178,6 @@ #define rpc_finish_wakeup(t) \ }while (0 ) #define RPC_IS_ACTIVATED(t) (test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)) -#define rpc_set_active (t) (set_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)) -#define rpc_clear_active (t) \ - do { \ - smp_mb__before_clear_bit(); \ - clear_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate); \ - smp_mb__after_clear_bit(); \ - } while(0)/* * Task priorities.
@@ -254,6 +247,7 @@ struct rpc_task *rpc_run_task(struct rpcvoid rpc_init_task (struct rpc_task *task,struct rpc_clnt *clnt,int flags,const struct rpc_call_ops *ops,void *data); +void rpc_put_task (struct rpc_task *);void rpc_release_task (struct rpc_task *);void rpc_exit_task (struct rpc_task *);void rpc_killall_tasks (struct rpc_clnt *);
net/sunrpc/clnt.c +10 -9
@@ -467,10 +467,9 @@ int rpc_call_sync(struct rpc_clnt *clnt,BUG_ON (flags &RPC_TASK_ASYNC ); - status = -ENOMEM ; task =rpc_new_task (clnt, flags, &rpc_default_ops,NULL );if (task ==NULL ) - goto out; +return -ENOMEM ;/* Mask signals on RPC calls _and_ GSS_AUTH upcalls */ rpc_task_sigmask (task, &oldset);
@@ -479,15 +478,17 @@ int rpc_call_sync(struct rpc_clnt *clnt,/* Set up the call info struct and execute the task */ status = task->tk_status; -if (status ==0 ) { -atomic_inc (&task->tk_count); - status =rpc_execute (task); -if (status ==0 ) - status = task->tk_status; +if (status !=0 ) { +rpc_release_task (task); + goto out; } -rpc_restore_sigmask (&oldset); -rpc_release_task (task); +atomic_inc (&task->tk_count); + status =rpc_execute (task); +if (status ==0 ) + status = task->tk_status; +rpc_put_task (task); out: +rpc_restore_sigmask (&oldset);return status; }
net/sunrpc/pmap_clnt.c +1 -1
@@ -134,7 +134,7 @@ void rpc_getport(struct rpc_task *task) child =rpc_run_task (pmap_clnt,RPC_TASK_ASYNC , &pmap_getport_ops, map);if (IS_ERR (child)) goto bailout; -rpc_release_task (child); +rpc_put_task (child); task->tk_xprt->stat.bind_count++;return ;
net/sunrpc/sched.c +47 -33
136 lines not on this page · raw message
net/sunrpc/sunrpc_syms.c +0 -1
@@ -33,7 +33,6 @@ EXPORT_SYMBOL(rpciod_down);EXPORT_SYMBOL (rpciod_up);EXPORT_SYMBOL (rpc_new_task);EXPORT_SYMBOL (rpc_wake_up_status); -EXPORT_SYMBOL (rpc_release_task);/* RPC client functions */ EXPORT_SYMBOL (rpc_clone_client);
Use RCU to ensure that we can safely call rpc_finish_wakeup after we've called __rpc_do_wake_up_task. If not, there is a theoretical race, in which the rpc_task finishes executing, and gets freed first.
---
fs/nfs/read.c | 8 +++++++- fs/nfs/write.c | 20 ++++++++++++++++---- include/linux/nfs_fs.h | 7 ++----- include/linux/sunrpc/sched.h | 2 ++ net/sunrpc/sched.c | 30 ++++++++++++++++++++---------- 5 files changed, 47 insertions(+), 20 deletions(-)
fs/nfs/read.c +7 -1
@@ -65,13 +65,19 @@ struct nfs_read_data *nfs_readdata_allocreturn p; } -static void nfs_readdata_free (struct nfs_read_data *p) +static void nfs_readdata_rcu_free (struct rcu_head *head) { + struct nfs_read_data *p = container_of(head, struct nfs_read_data, task.u.tk_rcu);if (p && (p->pagevec != &p->page_array[0 ]))kfree (p->pagevec);mempool_free (p, nfs_rdata_mempool); } +static void nfs_readdata_free (struct nfs_read_data *rdata) +{ +call_rcu_bh (&rdata->task.u.tk_rcu, nfs_readdata_rcu_free); +} +void nfs_readdata_release (void *data) {nfs_readdata_free (data);
fs/nfs/write.c +16 -4
@@ -102,13 +102,19 @@ struct nfs_write_data *nfs_commit_alloc(return p; } -void nfs_commit_free (struct nfs_write_data *p) +void nfs_commit_rcu_free (struct rcu_head *head) { + struct nfs_write_data *p = container_of(head, struct nfs_write_data, task.u.tk_rcu);if (p && (p->pagevec != &p->page_array[0 ]))kfree (p->pagevec);mempool_free (p, nfs_commit_mempool); } +void nfs_commit_free (struct nfs_write_data *wdata) +{ +call_rcu_bh (&wdata->task.u.tk_rcu, nfs_commit_rcu_free); +} +struct nfs_write_data *nfs_writedata_alloc (size_t len) {unsigned int pagecount = (len +PAGE_SIZE -1 ) >>PAGE_SHIFT ;
@@ -131,13 +137,19 @@ struct nfs_write_data *nfs_writedata_allreturn p; } -static void nfs_writedata_free (struct nfs_write_data *p) +static void nfs_writedata_rcu_free (struct rcu_head *head) { + struct nfs_write_data *p = container_of(head, struct nfs_write_data, task.u.tk_rcu);if (p && (p->pagevec != &p->page_array[0 ]))kfree (p->pagevec);mempool_free (p, nfs_wdata_mempool); } +static void nfs_writedata_free (struct nfs_write_data *wdata) +{ +call_rcu_bh (&wdata->task.u.tk_rcu, nfs_writedata_rcu_free); +} +void nfs_writedata_release (void *wdata) {nfs_writedata_free (wdata);
@@ -258,7 +270,7 @@ static int nfs_writepage_sync(struct nfs io_error:nfs_end_data_update (inode);end_page_writeback (page); -nfs_writedata_free (wdata); +nfs_writedata_release (wdata);return written ? written : result; }
@@ -1043,7 +1055,7 @@ out_bad:while (!list_empty (&list)) { data = list_entry(list.next, struct nfs_write_data, pages);list_del (&data->pages); -nfs_writedata_free (data); +nfs_writedata_release (data); }nfs_mark_request_dirty (req);nfs_clear_page_writeback (req);
include/linux/nfs_fs.h +2 -5
@@ -428,11 +428,6 @@ extern int nfs_updatepage(struct file *extern int nfs_writeback_done (struct rpc_task *,struct nfs_write_data *);extern void nfs_writedata_release (void *); -#if defined(CONFIG_NFS_V3 ) || defined(CONFIG_NFS_V4 ) -struct nfs_write_data *nfs_commit_alloc (void ); -void nfs_commit_free (struct nfs_write_data *p); -#endif -/* * Try to write back everything synchronously (but check the * return value!)
@@ -440,6 +435,8 @@ #endifextern int nfs_sync_inode_wait (struct inode *,unsigned long ,unsigned int ,int );#if defined(CONFIG_NFS_V3 ) || defined(CONFIG_NFS_V4 )extern int nfs_commit_inode (struct inode *,int ); +extern struct nfs_write_data *nfs_commit_alloc (void ); +extern void nfs_commit_free (struct nfs_write_data *wdata);extern void nfs_commit_release (void *wdata);#else static inline int
include/linux/sunrpc/sched.h +2 -0
@@ -11,6 +11,7 @@ #define _LINUX_SUNRPC_SCHED_H_#include <linux/timer.h> #include <linux/sunrpc/types.h> +#include <linux/rcupdate.h> #include <linux/spinlock.h> #include <linux/wait.h> #include <linux/workqueue.h>
@@ -85,6 +86,7 @@ #endifunion {struct work_struct tk_work;/* Async task work queue */ struct rpc_wait tk_wait;/* RPC wait */ +struct rcu_head tk_rcu;/* for task deletion */ } u;unsigned short tk_timeouts;/* maj timeouts */
net/sunrpc/sched.c +20 -10
@@ -427,16 +427,19 @@ __rpc_default_timer(struct rpc_task *tas*/ void rpc_wake_up_task (struct rpc_task *task) { +rcu_read_lock_bh ();if (rpc_start_wakeup (task)) {if (RPC_IS_QUEUED (task)) {struct rpc_wait_queue *queue = task->u.tk_wait.rpc_waitq; -spin_lock_bh (&queue->lock); +/* Note: we're already in a bh-safe context */ +spin_lock (&queue->lock);__rpc_do_wake_up_task (task); -spin_unlock_bh (&queue->lock); +spin_unlock (&queue->lock); }rpc_finish_wakeup (task); } +rcu_read_unlock_bh (); }/*
@@ -499,14 +502,16 @@ struct rpc_task * rpc_wake_up_next(strucstruct rpc_task *task =NULL ;dprintk ("RPC: wake_up_next(%p \"%s\")\n" , queue,rpc_qname (queue)); -spin_lock_bh (&queue->lock); +rcu_read_lock_bh (); +spin_lock (&queue->lock);if (RPC_IS_PRIORITY (queue)) task =__rpc_wake_up_next_priority (queue);else { task_for_first(task, &queue->tasks[0])__rpc_wake_up_task (task); } -spin_unlock_bh (&queue->lock); +spin_unlock (&queue->lock); +rcu_read_unlock_bh ();return task; }
@@ -522,7 +527,8 @@ void rpc_wake_up(struct rpc_wait_queue *struct rpc_task *task, *next;struct list_head *head; -spin_lock_bh (&queue->lock); +rcu_read_lock_bh (); +spin_lock (&queue->lock); head = &queue->tasks[queue->maxpriority];for (;;) {list_for_each_entry_safe (task, next, head, u.tk_wait.list)
@@ -531,7 +537,8 @@ void rpc_wake_up(struct rpc_wait_queue *break ; head--; } -spin_unlock_bh (&queue->lock); +spin_unlock (&queue->lock); +rcu_read_unlock_bh (); }/**
@@ -546,7 +553,8 @@ void rpc_wake_up_status(struct rpc_wait_struct rpc_task *task, *next;struct list_head *head; -spin_lock_bh (&queue->lock); +rcu_read_lock_bh (); +spin_lock (&queue->lock); head = &queue->tasks[queue->maxpriority];for (;;) {list_for_each_entry_safe (task, next, head, u.tk_wait.list) {
@@ -557,7 +565,8 @@ void rpc_wake_up_status(struct rpc_wait_break ; head--; } -spin_unlock_bh (&queue->lock); +spin_unlock (&queue->lock); +rcu_read_unlock_bh (); }static void __rpc_atrun (struct rpc_task *task)
@@ -817,8 +826,9 @@ rpc_alloc_task(void)return (struct rpc_task *)mempool_alloc (rpc_task_mempool,GFP_NOFS ); } -static void rpc_free_task (struct rpc_task *task) +static void rpc_free_task (struct rcu_head *rcu) { + struct rpc_task *task = container_of(rcu, struct rpc_task, u.tk_rcu);dprintk ("RPC: %4d freeing task\n" , task->tk_pid);mempool_free (task, rpc_task_mempool); }
@@ -872,7 +882,7 @@ void rpc_put_task(struct rpc_task *task) task->tk_client =NULL ; }if (task->tk_flags &RPC_TASK_DYNAMIC ) -rpc_free_task (task); +call_rcu_bh (&task->u.tk_rcu, rpc_free_task);if (tk_ops->rpc_release) tk_ops->rpc_release (calldata); }
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 30 lines · Trond Myklebust
Quoted 29 lines · Chris Caputo
Quoted 8 lines · Chris Caputo
I am not sure if this is related, but at just over 3 days of uptime with 2.6.19-rc6 and the Saout patch, I had this happen:
---
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000028 printing eip:
c029cf64
EIP is atcall_start+0x5c/0x6fI believe the above is the following line in clnt.c:call_start():
clnt->cl_stats->rpccnt++;
So
call_start()was called with a NULLtask->tk_client.Similar result with 2.6.19...
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000008 printing eip:
c029ef8e
EIP is atxprt_reserve+0x28/0x119In this one xprt.c:xprt_reserve() is I believe crashing at:
spin_lock(&xprt->reserve_lock);due to a NULL
task->tk_xprt.
Quoted 8 lines
Quoted 2 lines
Ideas on whether this is related to the Saout sched race patch or if this is something else entirely?
I suspect that it is related, but not the same race. I've identified a couple of other possible race conditions, mainly to do with the fact that nothing prevents an
rpc_taskfrom being freed while you are insiderpc_wake_up_task(). Could you try applying both the attached patches, and see if that helps?
I compiled 2.6.19 with your patches in addition to the Saout patch and a test is now in progress.
Thanks,
Chris
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 34 lines · Chris Caputo
Quoted 33 lines · Trond Myklebust
Quoted 31 lines · Chris Caputo
Quoted 8 lines · Chris Caputo
I am not sure if this is related, but at just over 3 days of uptime with 2.6.19-rc6 and the Saout patch, I had this happen:
---
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000028 printing eip:
c029cf64
EIP is atcall_start+0x5c/0x6fI believe the above is the following line in clnt.c:call_start():
clnt->cl_stats->rpccnt++;
So
call_start()was called with a NULLtask->tk_client.Similar result with 2.6.19...
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000008 printing eip:
c029ef8e
EIP is atxprt_reserve+0x28/0x119In this one xprt.c:xprt_reserve() is I believe crashing at:
spin_lock(&xprt->reserve_lock);due to a NULL
task->tk_xprt.Ideas on whether this is related to the Saout sched race patch or if this is something else entirely?
Quoted 8 lines
Quoted 5 lines
I suspect that it is related, but not the same race. I've identified a couple of other possible race conditions, mainly to do with the fact that nothing prevents an
rpc_taskfrom being freed while you are insiderpc_wake_up_task(). Could you try applying both the attached patches, and see if that helps?I compiled 2.6.19 with your patches in addition to the Saout patch and a test is now in progress.
With:
linux-2.6.19-001-fix_rpc_wakeup_race.dif
linux-2.6.19-002-cleanup_rpc_wakeup.dif
linux-2.6.19-003-rpc_wakeup_fix_pot_race.dif
My 2.6.19 test machine is now at 5 days 9+ hours of uptime with no problems and the following number of RPC calls:
Client rpc stats:
calls retrans authrefrsh
1314188163 2344 0
Previously a problem happened within between a few hours and up to 3 days of uptime, so this may be progress.
I'll leave the machine running and report back any problems.
Thanks,
Chris
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs