This is a note to let you know that I've just added the patch titled

    SUNRPC: Prevent races in xs_abort_connection()

to the 3.6-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sunrpc-prevent-races-in-xs_abort_connection.patch
and it can be found in the queue-3.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 4bc1e68ed6a8b59be8a79eb719be515a55c7bc68 Mon Sep 17 00:00:00 2001
From: Trond Myklebust <[email protected]>
Date: Tue, 23 Oct 2012 17:50:07 -0400
Subject: SUNRPC: Prevent races in xs_abort_connection()

From: Trond Myklebust <[email protected]>

commit 4bc1e68ed6a8b59be8a79eb719be515a55c7bc68 upstream.

The call to xprt_disconnect_done() that is triggered by a successful
connection reset will trigger another automatic wakeup of all tasks
on the xprt->pending rpc_wait_queue. In particular it will cause an
early wake up of the task that called xprt_connect().

All we really want to do here is clear all the socket-specific state
flags, so we split that functionality out of xs_sock_mark_closed()
into a helper that can be called by xs_abort_connection()

Reported-by: Chris Perl <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Tested-by: Chris Perl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 net/sunrpc/xprtsock.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1459,7 +1459,7 @@ static void xs_tcp_cancel_linger_timeout
        xprt_clear_connecting(xprt);
 }
 
-static void xs_sock_mark_closed(struct rpc_xprt *xprt)
+static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt)
 {
        smp_mb__before_clear_bit();
        clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
@@ -1467,6 +1467,11 @@ static void xs_sock_mark_closed(struct r
        clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
        clear_bit(XPRT_CLOSING, &xprt->state);
        smp_mb__after_clear_bit();
+}
+
+static void xs_sock_mark_closed(struct rpc_xprt *xprt)
+{
+       xs_sock_reset_connection_flags(xprt);
        /* Mark transport as closed and wake up all pending tasks */
        xprt_disconnect_done(xprt);
 }
@@ -2042,10 +2047,8 @@ static void xs_abort_connection(struct s
        any.sa_family = AF_UNSPEC;
        result = kernel_connect(transport->sock, &any, sizeof(any), 0);
        if (!result)
-               xs_sock_mark_closed(&transport->xprt);
-       else
-               dprintk("RPC:       AF_UNSPEC connect return code %d\n",
-                               result);
+               xs_sock_reset_connection_flags(&transport->xprt);
+       dprintk("RPC:       AF_UNSPEC connect return code %d\n", result);
 }
 
 static void xs_tcp_reuse_connection(struct sock_xprt *transport)


Patches currently in stable-queue which might be from 
[email protected] are

queue-3.6/lockd-fix-races-in-nsm_client_get.patch
queue-3.6/sunrpc-prevent-races-in-xs_abort_connection.patch
queue-3.6/lockd-clear-ln-nsm_clnt-only-when-ln-nsm_users-is-zero.patch
queue-3.6/sunrpc-clear-the-connect-flag-when-socket-state-is-tcp_close_wait.patch
queue-3.6/sunrpc-get-rid-of-the-xs_error_report-socket-callback.patch
queue-3.6/revert-sunrpc-ensure-we-close-the-socket-on-epipe-errors-too.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to