Commit 675b4698 authored by Pavel Emelyanov's avatar Pavel Emelyanov

tcp: Put connection locking management over the code

When dump finished with error we should unlock all locked
previously connections.

When restoring we should collect connctions and unlock them
all at the end.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent a53aa45b
......@@ -34,6 +34,7 @@
#include "parasite.h"
#include "parasite-syscall.h"
#include "files.h"
#include "sk-inet.h"
#ifndef CONFIG_X86_64
# error No x86-32 support yet
......@@ -1917,6 +1918,14 @@ err:
xfree(shmems);
xfree(pipes);
close_cr_fdset(&glob_fdset);
/*
* If we've failed to do anything -- unlock all TCP sockets
* so that the connections can go on. But if we succeeded --
* don't, just close them silently.
*/
if (ret)
tcp_unlock_all();
pstree_switch_state(&pstree_list,
ret ? TASK_ALIVE : opts->final_state);
free_pstree(&pstree_list);
......
......@@ -33,6 +33,7 @@
#include "sockets.h"
#include "lock.h"
#include "files.h"
#include "sk-inet.h"
#include "proc_parse.h"
#include "restorer-blob.h"
#include "crtools.h"
......@@ -918,6 +919,7 @@ out:
*/
clear_ghost_files();
tcp_unlock_connections();
pr_info("Go on!!!\n");
futex_set_and_wake(&task_entries->start, CR_STATE_COMPLETE);
......
......@@ -24,6 +24,10 @@ struct inet_sk_info {
int inet_bind(int sk, struct inet_sk_info *);
int inet_connect(int sk, struct inet_sk_info *);
void tcp_unlock_all(void);
void tcp_locked_conn_add(struct inet_sk_info *);
void tcp_unlock_connections(void);
static inline int dump_one_tcp(int sk, struct inet_sk_desc *sd)
{
return -1;
......
......@@ -201,6 +201,9 @@ int collect_inet_sockets(void)
file_desc_add(&ii->d, FDINFO_INETSK, ii->ie.id,
&inet_desc_ops);
if (tcp_connection(&ii->ie))
tcp_locked_conn_add(ii);
}
if (ii)
......
......@@ -4,6 +4,18 @@
#include "files.h"
#include "sk-inet.h"
void tcp_unlock_all(void)
{
}
void tcp_locked_conn_add(struct inet_sk_info *ii)
{
}
void tcp_unlock_connections(void)
{
}
void show_tcp_stream(int fd, struct cr_options *opt)
{
struct tcp_stream_entry tse;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment