From: Eric Van Hensbergen This part of the patch contains transport routine changes related to hch's comments. Signed-off-by: Eric Van Hensbergen Signed-off-by: Andrew Morton --- fs/9p/mux.c | 46 ++++++++++++++++------------------------------ fs/9p/trans_sock.c | 2 +- 2 files changed, 17 insertions(+), 31 deletions(-) diff -puN fs/9p/mux.c~v9fs-transport-modules-resend-take-2 fs/9p/mux.c --- devel/fs/9p/mux.c~v9fs-transport-modules-resend-take-2 2005-07-14 16:23:38.000000000 -0700 +++ devel-akpm/fs/9p/mux.c 2005-07-14 16:23:38.000000000 -0700 @@ -29,9 +29,9 @@ #include #include #include +#include #include "debug.h" -#include "idpool.h" #include "v9fs.h" #include "9p.h" #include "transport.h" @@ -160,30 +160,19 @@ static int v9fs_recv(struct v9fs_session int ret = 0; dprintk(DEBUG_MUX, "waiting for response: %d\n", req->tcall->tag); - ret = wait_event_interruptible_timeout(v9ses->read_wait, + ret = wait_event_interruptible(v9ses->read_wait, ((v9ses->transport->status != Connected) || - (req->rcall != 0) || dprintcond(v9ses, req)), - msecs_to_jiffies(v9ses->timeout)); + (req->rcall != 0) || dprintcond(v9ses, req))); dprintk(DEBUG_MUX, "got it: rcall %p\n", req->rcall); if (v9ses->transport->status == Disconnected) return -ECONNRESET; - if (ret >= 0) { + if (ret == 0) { spin_lock(&v9ses->muxlock); list_del(&req->next); spin_unlock(&v9ses->muxlock); } - if (ret == 0) { /* timeout */ - dprintk(DEBUG_ERROR, "Connection timeout after %u (%u)\n", - v9ses->timeout, - (unsigned int)msecs_to_jiffies(v9ses->timeout)); - v9ses->session_hung = 1; - v9ses->transport->status = Hung; - return -ETIMEDOUT; - } else { - ret = 0; /* reset return code */ - } return ret; } @@ -273,7 +262,8 @@ v9fs_mux_rpc(struct v9fs_session_info *v ret = v9fs_send(v9ses, &req); if (ret < 0) { - v9fs_put_idpool(tid, &v9ses->tidpool); + if (tcall->id != TVERSION) + v9fs_put_idpool(tid, &v9ses->tidpool); dprintk(DEBUG_MUX, "error %d\n", ret); return ret; } @@ -323,7 +313,8 @@ v9fs_mux_rpc(struct v9fs_session_info *v } release_req: - v9fs_put_idpool(tid, &v9ses->tidpool); + if (tcall->id != TVERSION) + v9fs_put_idpool(tid, &v9ses->tidpool); if (rcall) *rcall = fcall; else @@ -342,19 +333,19 @@ static int v9fs_recvproc(void *data) { struct v9fs_session_info *v9ses = (struct v9fs_session_info *)data; struct v9fs_fcall *rcall = NULL; - struct list_head *rptr; - struct list_head *rrptr; + struct v9fs_rpcreq *rptr; struct v9fs_rpcreq *req; + struct v9fs_rpcreq *rreq; int err = 0; allow_signal(SIGKILL); set_current_state(TASK_INTERRUPTIBLE); complete(&v9ses->proccmpl); while (!kthread_should_stop() && err >= 0) { - req = NULL; + req = rptr = rreq = NULL; rcall = kmalloc(v9ses->maxdata + V9FS_IOHDRSZ, GFP_KERNEL); - if(!rcall) { + if (!rcall) { eprintk(KERN_ERR, "no memory for buffers\n"); break; } @@ -365,10 +356,7 @@ static int v9fs_recvproc(void *data) break; } spin_lock(&v9ses->muxlock); - list_for_each_safe(rptr, rrptr, &v9ses->mux_fcalls) { - struct v9fs_rpcreq *rreq = - list_entry(rptr, struct v9fs_rpcreq, next); - + list_for_each_entry_safe(rreq, rptr, &v9ses->mux_fcalls, next) { if (rreq->tcall->tag == rcall->tag) { req = rreq; req->rcall = rcall; @@ -377,13 +365,11 @@ static int v9fs_recvproc(void *data) } if (req && (req->tcall->id == TFLUSH)) { - list_for_each_safe(rptr, rrptr, &v9ses->mux_fcalls) { - struct v9fs_rpcreq *treq = - list_entry(rptr, struct v9fs_rpcreq, next); - + struct v9fs_rpcreq *treq = NULL; + list_for_each_entry_safe(treq, rptr, &v9ses->mux_fcalls, next) { if (treq->tcall->tag == req->tcall->params.tflush.oldtag) { - list_del(rptr); + list_del(&rptr->next); kfree(treq->rcall); break; } diff -puN fs/9p/trans_sock.c~v9fs-transport-modules-resend-take-2 fs/9p/trans_sock.c --- devel/fs/9p/trans_sock.c~v9fs-transport-modules-resend-take-2 2005-07-14 16:23:38.000000000 -0700 +++ devel-akpm/fs/9p/trans_sock.c 2005-07-14 16:23:38.000000000 -0700 @@ -34,9 +34,9 @@ #include #include #include +#include #include "debug.h" -#include "idpool.h" #include "v9fs.h" #include "transport.h" _