2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

cr-dump: lock network before dump and unlock in case of errors

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2012-09-17 20:05:55 +04:00
committed by Pavel Emelyanov
parent fbea445df4
commit 3957a9a69a
3 changed files with 34 additions and 1 deletions

26
net.c
View File

@@ -11,6 +11,7 @@
#include "net.h"
#include "libnetlink.h"
#include "crtools.h"
#include "sk-inet.h"
#include "protobuf.h"
#include "protobuf/netdev.pb-c.h"
@@ -405,3 +406,28 @@ int netns_pre_create(void)
pr_info("Saved netns fd for links restore\n");
return 0;
}
int network_lock(void)
{
pr_info("Lock network\n");
/* Each connection will be locked on dump */
if (!(opts.namespaces_flags & CLONE_NEWNET))
return 0;
return run_scripts("network-lock");
}
void network_unlock(void)
{
pr_info("Unlock network\n");
if (!(opts.namespaces_flags & CLONE_NEWNET)) {
tcp_unlock_all();
return;
}
run_scripts("network-unlock");
}