[Devel,RHEL7,COMMIT] ms/tcp: allow to enable the repair mode for non-listening sockets

Submitted by Konstantin Khorenko on Dec. 8, 2016, 1:19 p.m.

Details

Message ID 201612081319.uB8DJLxD002984@finist_cl7.x64_64.work.ct
State New
Series "ms/tcp: allow to enable the repair mode for non-listening sockets"
Headers show

Commit Message

Konstantin Khorenko Dec. 8, 2016, 1:19 p.m.
The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.20.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.20.12
------>
commit b7fd6404e2ece53d7a99fe3dd5695efe77dfacb1
Author: Andrey Vagin <avagin@openvz.org>
Date:   Thu Dec 8 17:19:19 2016 +0400

    ms/tcp: allow to enable the repair mode for non-listening sockets
    
    ML: 319b0534b9588124cdc7128e121f3f85daaab556
    
    The repair mode is used to get and restore sequence numbers and
    data from queues. It used to checkpoint/restore connections.
    
    Currently the repair mode can be enabled for sockets in the established
    and closed states, but for other states we have to dump the same socket
    properties, so lets allow to enable repair mode for these sockets.
    
    The repair mode reveals nothing more for sockets in other states.
    
    Signed-off-by: Andrei Vagin <avagin@openvz.org>
    Acked-by: Pavel Emelyanov <xemul@openvz.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    
    This is required for half-closed sockets CRIU support:
    https://jira.sw.ru/browse/PSBM-46381
---
 net/ipv4/tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e8e70ea..1af05a4 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2262,7 +2262,7 @@  void tcp_sock_destruct(struct sock *sk)
 static inline bool tcp_can_repair_sock(const struct sock *sk)
 {
 	return ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN) &&
-		((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_ESTABLISHED));
+		(sk->sk_state != TCP_LISTEN);
 }
 
 static int tcp_repair_set_window(struct tcp_sock *tp, char __user *optbuf, int len)