lkml.org 
[lkml]   [2009]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 23/37] SUNRPC: Dont disconnect if a connection is still in progress.
    2.6.27-stable review patch.  If anyone has any objections, please let us know.

    ------------------

    From: Trond Myklebust <Trond.Myklebust@netapp.com>

    commit 40d2549db5f515e415894def98b49db7d4c56714 upstream.

    Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    net/sunrpc/xprtsock.c | 18 ++++++++++++++----
    1 file changed, 14 insertions(+), 4 deletions(-)

    --- a/net/sunrpc/xprtsock.c
    +++ b/net/sunrpc/xprtsock.c
    @@ -1560,10 +1560,9 @@ out:
    * We need to preserve the port number so the reply cache on the server can
    * find our cached RPC replies when we get around to reconnecting.
    */
    -static void xs_tcp_reuse_connection(struct rpc_xprt *xprt)
    +static void xs_abort_connection(struct rpc_xprt *xprt, struct sock_xprt *transport)
    {
    int result;
    - struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
    struct sockaddr any;

    dprintk("RPC: disconnecting xprt %p to reuse port\n", xprt);
    @@ -1580,6 +1579,17 @@ static void xs_tcp_reuse_connection(stru
    result);
    }

    +static void xs_tcp_reuse_connection(struct rpc_xprt *xprt, struct sock_xprt *transport)
    +{
    + unsigned int state = transport->inet->sk_state;
    +
    + if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED)
    + return;
    + if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT))
    + return;
    + xs_abort_connection(xprt, transport);
    +}
    +
    static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
    {
    struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
    @@ -1650,7 +1660,7 @@ static void xs_tcp_connect_worker4(struc
    }
    } else
    /* "close" the socket, preserving the local port */
    - xs_tcp_reuse_connection(xprt);
    + xs_tcp_reuse_connection(xprt, transport);

    dprintk("RPC: worker connecting xprt %p to address: %s\n",
    xprt, xprt->address_strings[RPC_DISPLAY_ALL]);
    @@ -1710,7 +1720,7 @@ static void xs_tcp_connect_worker6(struc
    }
    } else
    /* "close" the socket, preserving the local port */
    - xs_tcp_reuse_connection(xprt);
    + xs_tcp_reuse_connection(xprt, transport);

    dprintk("RPC: worker connecting xprt %p to address: %s\n",
    xprt, xprt->address_strings[RPC_DISPLAY_ALL]);



    \
     
     \ /
      Last update: 2009-07-29 01:09    [W:5.137 / U:0.328 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site