]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Oct 2012 19:36:37 +0000 (12:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Oct 2012 19:36:37 +0000 (12:36 -0700)
added patches:
revert-sunrpc-ensure-we-close-the-socket-on-epipe-errors-too.patch
sunrpc-clear-the-connect-flag-when-socket-state-is-tcp_close_wait.patch
sunrpc-get-rid-of-the-xs_error_report-socket-callback.patch
sunrpc-prevent-races-in-xs_abort_connection.patch

queue-3.0/revert-sunrpc-ensure-we-close-the-socket-on-epipe-errors-too.patch [new file with mode: 0644]
queue-3.0/series
queue-3.0/sunrpc-clear-the-connect-flag-when-socket-state-is-tcp_close_wait.patch [new file with mode: 0644]
queue-3.0/sunrpc-get-rid-of-the-xs_error_report-socket-callback.patch [new file with mode: 0644]
queue-3.0/sunrpc-prevent-races-in-xs_abort_connection.patch [new file with mode: 0644]

diff --git a/queue-3.0/revert-sunrpc-ensure-we-close-the-socket-on-epipe-errors-too.patch b/queue-3.0/revert-sunrpc-ensure-we-close-the-socket-on-epipe-errors-too.patch
new file mode 100644 (file)
index 0000000..6e40052
--- /dev/null
@@ -0,0 +1,38 @@
+From b9d2bb2ee537424a7f855e1f93eed44eb9ee0854 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+Date: Tue, 23 Oct 2012 11:40:02 -0400
+Subject: Revert "SUNRPC: Ensure we close the socket on EPIPE errors too..."
+
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+
+commit b9d2bb2ee537424a7f855e1f93eed44eb9ee0854 upstream.
+
+This reverts commit 55420c24a0d4d1fce70ca713f84aa00b6b74a70e.
+Now that we clear the connected flag when entering TCP_CLOSE_WAIT,
+the deadlock described in this commit is no longer possible.
+Instead, the resulting call to xs_tcp_shutdown() can interfere
+with pending reconnection attempts.
+
+Reported-by: Chris Perl <chris.perl@gmail.com>
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Tested-by: Chris Perl <chris.perl@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/sunrpc/xprtsock.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/sunrpc/xprtsock.c
++++ b/net/sunrpc/xprtsock.c
+@@ -725,10 +725,10 @@ static int xs_tcp_send_request(struct rp
+               dprintk("RPC:       sendmsg returned unrecognized error %d\n",
+                       -status);
+       case -ECONNRESET:
+-      case -EPIPE:
+               xs_tcp_shutdown(xprt);
+       case -ECONNREFUSED:
+       case -ENOTCONN:
++      case -EPIPE:
+               clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
+       }
index 9e38089c5ae7fdbebd1b018d0610947992c724ad..d9d5abc1189fca06743ac69eea84df3cf331d8d7 100644 (file)
@@ -3,3 +3,7 @@ fs-compat_ioctl.c-video_set_spu_palette-missing-error-check.patch
 drivers-rtc-rtc-imxdi.c-add-missing-spin-lock-initialization.patch
 genalloc-stop-crashing-the-system-when-destroying-a-pool.patch
 arm-7559-1-smp-switch-away-from-the-idmap-before-updating-init_mm.mm_count.patch
+sunrpc-get-rid-of-the-xs_error_report-socket-callback.patch
+sunrpc-clear-the-connect-flag-when-socket-state-is-tcp_close_wait.patch
+revert-sunrpc-ensure-we-close-the-socket-on-epipe-errors-too.patch
+sunrpc-prevent-races-in-xs_abort_connection.patch
diff --git a/queue-3.0/sunrpc-clear-the-connect-flag-when-socket-state-is-tcp_close_wait.patch b/queue-3.0/sunrpc-clear-the-connect-flag-when-socket-state-is-tcp_close_wait.patch
new file mode 100644 (file)
index 0000000..fc13433
--- /dev/null
@@ -0,0 +1,30 @@
+From d0bea455dd48da1ecbd04fedf00eb89437455fdc Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+Date: Tue, 23 Oct 2012 11:35:47 -0400
+Subject: SUNRPC: Clear the connect flag when socket state is TCP_CLOSE_WAIT
+
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+
+commit d0bea455dd48da1ecbd04fedf00eb89437455fdc upstream.
+
+This is needed to ensure that we call xprt_connect() upon the next
+call to call_connect().
+
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Tested-by: Chris Perl <chris.perl@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/sunrpc/xprtsock.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/net/sunrpc/xprtsock.c
++++ b/net/sunrpc/xprtsock.c
+@@ -1512,6 +1512,7 @@ static void xs_tcp_state_change(struct s
+       case TCP_CLOSE_WAIT:
+               /* The server initiated a shutdown of the socket */
+               xprt->connect_cookie++;
++              clear_bit(XPRT_CONNECTED, &xprt->state);
+               xs_tcp_force_close(xprt);
+       case TCP_CLOSING:
+               /*
diff --git a/queue-3.0/sunrpc-get-rid-of-the-xs_error_report-socket-callback.patch b/queue-3.0/sunrpc-get-rid-of-the-xs_error_report-socket-callback.patch
new file mode 100644 (file)
index 0000000..718ef55
--- /dev/null
@@ -0,0 +1,105 @@
+From f878b657ce8e7d3673afe48110ec208a29e38c4a Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+Date: Mon, 22 Oct 2012 17:14:36 -0400
+Subject: SUNRPC: Get rid of the xs_error_report socket callback
+
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+
+commit f878b657ce8e7d3673afe48110ec208a29e38c4a upstream.
+
+Chris Perl reports that we're seeing races between the wakeup call in
+xs_error_report and the connect attempts. Basically, Chris has shown
+that in certain circumstances, the call to xs_error_report causes the
+rpc_task that is responsible for reconnecting to wake up early, thus
+triggering a disconnect and retry.
+
+Since the sk->sk_error_report() calls in the socket layer are always
+followed by a tcp_done() in the cases where we care about waking up
+the rpc_tasks, just let the state_change callbacks take responsibility
+for those wake ups.
+
+Reported-by: Chris Perl <chris.perl@gmail.com>
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Tested-by: Chris Perl <chris.perl@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/sunrpc/xprtsock.c |   25 -------------------------
+ 1 file changed, 25 deletions(-)
+
+--- a/net/sunrpc/xprtsock.c
++++ b/net/sunrpc/xprtsock.c
+@@ -243,7 +243,6 @@ struct sock_xprt {
+       void                    (*old_data_ready)(struct sock *, int);
+       void                    (*old_state_change)(struct sock *);
+       void                    (*old_write_space)(struct sock *);
+-      void                    (*old_error_report)(struct sock *);
+ };
+ /*
+@@ -768,7 +767,6 @@ static void xs_save_old_callbacks(struct
+       transport->old_data_ready = sk->sk_data_ready;
+       transport->old_state_change = sk->sk_state_change;
+       transport->old_write_space = sk->sk_write_space;
+-      transport->old_error_report = sk->sk_error_report;
+ }
+ static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *sk)
+@@ -776,7 +774,6 @@ static void xs_restore_old_callbacks(str
+       sk->sk_data_ready = transport->old_data_ready;
+       sk->sk_state_change = transport->old_state_change;
+       sk->sk_write_space = transport->old_write_space;
+-      sk->sk_error_report = transport->old_error_report;
+ }
+ static void xs_reset_transport(struct sock_xprt *transport)
+@@ -1539,25 +1536,6 @@ static void xs_tcp_state_change(struct s
+       read_unlock_bh(&sk->sk_callback_lock);
+ }
+-/**
+- * xs_error_report - callback mainly for catching socket errors
+- * @sk: socket
+- */
+-static void xs_error_report(struct sock *sk)
+-{
+-      struct rpc_xprt *xprt;
+-
+-      read_lock_bh(&sk->sk_callback_lock);
+-      if (!(xprt = xprt_from_sock(sk)))
+-              goto out;
+-      dprintk("RPC:       %s client %p...\n"
+-                      "RPC:       error %d\n",
+-                      __func__, xprt, sk->sk_err);
+-      xprt_wake_pending_tasks(xprt, -EAGAIN);
+-out:
+-      read_unlock_bh(&sk->sk_callback_lock);
+-}
+-
+ static void xs_write_space(struct sock *sk)
+ {
+       struct socket *sock;
+@@ -1857,7 +1835,6 @@ static int xs_local_finish_connecting(st
+               sk->sk_user_data = xprt;
+               sk->sk_data_ready = xs_local_data_ready;
+               sk->sk_write_space = xs_udp_write_space;
+-              sk->sk_error_report = xs_error_report;
+               sk->sk_allocation = GFP_ATOMIC;
+               xprt_clear_connected(xprt);
+@@ -1946,7 +1923,6 @@ static void xs_udp_finish_connecting(str
+               sk->sk_user_data = xprt;
+               sk->sk_data_ready = xs_udp_data_ready;
+               sk->sk_write_space = xs_udp_write_space;
+-              sk->sk_error_report = xs_error_report;
+               sk->sk_no_check = UDP_CSUM_NORCV;
+               sk->sk_allocation = GFP_ATOMIC;
+@@ -2062,7 +2038,6 @@ static int xs_tcp_finish_connecting(stru
+               sk->sk_data_ready = xs_tcp_data_ready;
+               sk->sk_state_change = xs_tcp_state_change;
+               sk->sk_write_space = xs_tcp_write_space;
+-              sk->sk_error_report = xs_error_report;
+               sk->sk_allocation = GFP_ATOMIC;
+               /* socket options */
diff --git a/queue-3.0/sunrpc-prevent-races-in-xs_abort_connection.patch b/queue-3.0/sunrpc-prevent-races-in-xs_abort_connection.patch
new file mode 100644 (file)
index 0000000..9b2356d
--- /dev/null
@@ -0,0 +1,63 @@
+From 4bc1e68ed6a8b59be8a79eb719be515a55c7bc68 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+Date: Tue, 23 Oct 2012 17:50:07 -0400
+Subject: SUNRPC: Prevent races in xs_abort_connection()
+
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+
+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 <chris.perl@gmail.com>
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Tested-by: Chris Perl <chris.perl@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/sunrpc/xprtsock.c |   13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+--- a/net/sunrpc/xprtsock.c
++++ b/net/sunrpc/xprtsock.c
+@@ -1449,7 +1449,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);
+@@ -1457,6 +1457,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);
+ }
+@@ -1991,10 +1996,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)