--- zzzz-none-000/linux-2.6.32.61/net/sunrpc/xprtsock.c 2013-06-10 09:43:48.000000000 +0000 +++ ar10-7272-687/linux-2.6.32.61/net/sunrpc/xprtsock.c 2012-09-04 17:04:21.000000000 +0000 @@ -493,7 +493,7 @@ struct rpc_rqst *req = task->tk_rqstp; struct rpc_xprt *xprt = req->rq_xprt; struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); - int ret = -EAGAIN; + int ret = 0; dprintk("RPC: %5u xmit incomplete (%u left of %u)\n", task->tk_pid, req->rq_slen - req->rq_bytes_sent, @@ -505,6 +505,7 @@ /* Don't race with disconnect */ if (xprt_connected(xprt)) { if (test_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags)) { + ret = -EAGAIN; /* * Notify TCP that we're limited by the application * window size @@ -563,6 +564,8 @@ /* Still some bytes left; set up for a retry later. */ status = -EAGAIN; } + if (!transport->sock) + goto out; switch (status) { case -ENOTSOCK: @@ -582,7 +585,7 @@ * prompts ECONNREFUSED. */ clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); } - +out: return status; } @@ -664,6 +667,8 @@ status = -EAGAIN; break; } + if (!transport->sock) + goto out; switch (status) { case -ENOTSOCK: @@ -683,7 +688,7 @@ case -ENOTCONN: clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); } - +out: return status; } @@ -1376,6 +1381,7 @@ case TCP_CLOSE_WAIT: /* The server initiated a shutdown of the socket */ xprt_force_disconnect(xprt); + case TCP_SYN_SENT: xprt->connect_cookie++; case TCP_CLOSING: /* @@ -2220,7 +2226,7 @@ { struct rpc_rqst *req = task->tk_rqstp; struct svc_xprt *xprt; - struct svc_sock *svsk; + /*--- struct svc_sock *svsk; ---*/ u32 len; dprintk("sending request with xid: %08x\n", ntohl(req->rq_xid)); @@ -2228,7 +2234,7 @@ * Get the server socket associated with this callback xprt */ xprt = req->rq_xprt->bc_xprt; - svsk = container_of(xprt, struct svc_sock, sk_xprt); + /*--- svsk = container_of(xprt, struct svc_sock, sk_xprt); ---*/ /* * Grab the mutex to serialize data as the connection is shared