[CRIU] [RFC v2 1/5] fix network unlock in check case

Adrian Reber adrian at lisas.de
Thu Mar 23 12:59:14 PDT 2017


From: Adrian Reber <areber at redhat.com>

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 criu/cr-restore.c | 5 +++--
 criu/sk-tcp.c     | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index d0a970b..568c109 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1965,8 +1965,9 @@ static int restore_root_task(struct pstree_item *init)
 	if (write_restored_pid())
 		goto out_kill;
 
-	/* Unlock network before disabling repair mode on sockets */
-	network_unlock();
+	if (!opts.check_only)
+		/* Unlock network before disabling repair mode on sockets */
+		network_unlock();
 
 	/*
 	 * Stop getting sigchld, after we resume the tasks they
diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
index 3acc710..66c553d 100644
--- a/criu/sk-tcp.c
+++ b/criu/sk-tcp.c
@@ -22,6 +22,7 @@
 #include "kerndat.h"
 #include "restorer.h"
 #include "rst-malloc.h"
+#include "cr_options.h"
 
 #include "protobuf.h"
 #include "images/tcp-stream.pb-c.h"
@@ -346,6 +347,9 @@ static int restore_tcp_conn_state(int sk, struct libsoccr_sk *socr, struct inet_
 	if (read_tcp_queues(socr, &data, img))
 		goto err_c;
 
+	if (opts.check_only)
+		goto skip_for_check;
+
 	if (libsoccr_restore(socr, &data, sizeof(data)))
 		goto err_c;
 
@@ -361,6 +365,7 @@ static int restore_tcp_conn_state(int sk, struct libsoccr_sk *socr, struct inet_
 			goto err_c;
 	}
 
+skip_for_check:
 	tcp_stream_entry__free_unpacked(tse, NULL);
 	close_image(img);
 	return 0;
-- 
1.8.3.1



More information about the CRIU mailing list