Messages in this thread Patch in this message | | | Date | Mon, 11 Jan 1999 16:59:38 +0000 (GMT) | From | Dave Airlie <> | Subject | [patch] NFS over TCP (final hopefully) (fwd) |
| |
And of course it helps if you include the patch :-) ..
Dave.
------------ David Airlie, David.Airlie@ul.ie,airlied@skynet -------- Telecommunications Research Centre, ECE Dept, University of Limerick \ http://www.csn.ul.ie/~airlied -- Telecommunications Researcher \ --- TEL: +353-61-202695 -----------------------------------------------
---------- Forwarded message ---------- Date: Mon, 11 Jan 1999 16:52:58 +0000 (GMT) From: Dave Airlie <airlied@skynet.csn.ul.ie> To: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: linux-kernel@vger.rutgers.edu Subject: [patch] NFS over TCP (final hopefully)
Hi again,
Here is a patch for NFS over TCP (which fixes write and reconnect problems) it is against 2.2.0-pre6.
it contains the previous write only fix and the credits patch I sent out earlier,
the write bug was a problem with a callback handler setting another callback handler, and the disconnect problem I fixed by moving a check out of xprt_recvmsg and allowing it to return 0 indication an empty packet (which works for me but may not be exactly the right thing .. it seems to be the right thing however .. )
So NFS over TCP should be fixed now...
one for the Irish :-) (who said all we did was drink ?)
Dave.
------------ David Airlie, David.Airlie@ul.ie,airlied@skynet -------- Telecommunications Research Centre, ECE Dept, University of Limerick \ http://www.csn.ul.ie/~airlied -- Telecommunications Researcher \ --- TEL: +353-61-202695 -----------------------------------------------
diff -ur linux-orig/net/sunrpc/sched.c linux/net/sunrpc/sched.c --- linux-orig/net/sunrpc/sched.c Sun Jan 10 20:11:55 1999 +++ linux/net/sunrpc/sched.c Sun Jan 10 20:19:42 1999 @@ -5,6 +5,8 @@ * * Copyright (C) 1996 Olaf Kirch, <okir@monad.swb.de> * + * TCP NFS related read + write fixes + * (C) 1999 Dave Airlie, University of Limerick, Ireland <airlied@linux.ie> */ #include <linux/module.h> @@ -272,8 +274,8 @@ if (task->tk_rpcwait != &schedq) rpc_remove_wait_queue(task); if (!RPC_IS_RUNNING(task)) { - rpc_make_runnable(task); task->tk_flags |= RPC_TASK_CALLBACK; + rpc_make_runnable(task); } dprintk("RPC: __rpc_wake_up done\n"); } @@ -392,10 +394,21 @@ * Execute any pending callback. */ if (task->tk_flags & RPC_TASK_CALLBACK) { + /* Define a callback save pointer */ + void (*save_callback)(struct rpc_task *); + task->tk_flags &= ~RPC_TASK_CALLBACK; + /* + * If a callback exists, save it, reset it, + * call it. + * The save is needed to stop from resetting + * another callback set within the callback handler + * - Dave + */ if (task->tk_callback) { - task->tk_callback(task); - task->tk_callback = NULL; + save_callback=task->tk_callback; + task->tk_callback=NULL; + save_callback(task); } } diff -ur linux-orig/net/sunrpc/xprt.c linux/net/sunrpc/xprt.c --- linux-orig/net/sunrpc/xprt.c Sun Jan 10 20:11:51 1999 +++ linux/net/sunrpc/xprt.c Mon Jan 11 17:43:57 1999 @@ -35,6 +35,8 @@ * * TCP callback races fixes (C) 1998 Red Hat Software <alan@redhat.com> * TCP send fixes (C) 1998 Red Hat Software <alan@redhat.com> + * TCP NFS related read + write fixes + * (C) 1999 Dave Airlie, University of Limerick, Ireland <airlied@linux.ie> */ #define __KERNEL_SYSCALLS__ @@ -272,9 +274,6 @@ set_fs(oldfs); #endif - if (!result && len) - result = -EAGAIN; - dprintk("RPC: xprt_recvmsg(iov %p, len %d) = %d\n", iov, len, result); return result; @@ -639,6 +638,11 @@ riov.iov_base = xprt->tcp_recm.data + offset; riov.iov_len = want; result = xprt_recvmsg(xprt, &riov, 1, want); + if (!result) + { + dprintk("RPC: empty TCP record.\n"); + return -ENOTCONN; + } if (result < 0) goto done; offset += result; @@ -684,6 +688,8 @@ dprintk("RPC: %4d TCP receiving %d bytes\n", req->rq_task->tk_pid, want); result = xprt_recvmsg(xprt, xprt->tcp_iovec, req->rq_rnr, want); + if (!result && want) + result = -EAGAIN; if (result < 0) goto done; xprt->tcp_copied += result; @@ -715,6 +721,8 @@ riov.iov_len = want; dprintk("RPC: TCP skipping %d bytes\n", want); result = xprt_recvmsg(xprt, &riov, 1, want); + if (!result && want) + result=-EAGAIN; if (result < 0) goto done; offset += result; @@ -871,14 +879,14 @@ if (!(xprt = xprt_from_sock(sk))) return; if(xprt->snd_sent && xprt->snd_task) - printk("write space\n"); + dprintk("RPC: write space\n"); if(xprt->write_space == 0) { xprt->write_space = 1; if (xprt->snd_task && !RPC_IS_RUNNING(xprt->snd_task)) { if(xprt->snd_sent) - printk("Write wakeup snd_sent =%d\n", + dprintk("RPC: Write wakeup snd_sent =%d\n", xprt->snd_sent); rpc_wake_up_task(xprt->snd_task); } @@ -945,8 +953,6 @@ struct rpc_xprt *xprt = req->rq_xprt; int status; - /*DEBUG*/int ac_debug=xprt->snd_sent; - dprintk("RPC: %4d xprt_transmit(%x)\n", task->tk_pid, *(u32 *)(req->rq_svec[0].iov_base)); @@ -994,7 +1000,6 @@ xprt->snd_buf = req->rq_snd_buf; xprt->snd_task = task; xprt->snd_sent = 0; - /*DEBUG*/ac_debug = 0; } /* For fast networks/servers we have to put the request on @@ -1022,12 +1027,10 @@ if (xprt_transmit_some(xprt, task) != -EAGAIN) { dprintk("RPC: %4d xmit complete\n", task->tk_pid); xprt->snd_task = NULL; - if(ac_debug) - printk("Partial xmit finished\n"); return; } - /*d*/printk("RPC: %4d xmit incomplete (%d left of %d)\n", + /*d*/dprintk("RPC: %4d xmit incomplete (%d left of %d)\n", task->tk_pid, xprt->snd_buf.io_len, req->rq_slen); task->tk_status = 0; --- linux-orig/CREDITS Thu Jan 7 16:41:54 1999 +++ linux/CREDITS Mon Jan 11 13:16:56 1999 @@ -16,6 +16,13 @@ S: (ask for current address) S: Finland +N: Dave Airlie +E: airlied@linux.ie +W: http://www.csn.ul.ie/~airlied +D: NFS over TCP patches +S: University of Limerick +S: Ireland + N: Werner Almesberger E: werner.almesberger@lrc.di.epfl.ch D: dosfs, LILO, some fd features, various other hacks here and there
| |