[CRIU] [PATCH 2/6] pipe: Run master resolve via post_cb engine
Pavel Emelyanov
xemul at virtuozzo.com
Thu Mar 24 06:00:35 PDT 2016
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/cr-restore.c | 2 --
criu/include/pipes.h | 1 -
criu/pipes.c | 8 +++++++-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 467ad07..13e07c5 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -271,8 +271,6 @@ static int root_prepare_shared(void)
if (ret < 0)
goto err;
- mark_pipe_master();
-
ret = tty_setup_slavery();
if (ret)
goto err;
diff --git a/criu/include/pipes.h b/criu/include/pipes.h
index 06db31b..b46be2d 100644
--- a/criu/include/pipes.h
+++ b/criu/include/pipes.h
@@ -6,7 +6,6 @@
extern struct collect_image_info pipe_cinfo;
extern int collect_pipes(void);
-extern void mark_pipe_master(void);
extern const struct fdtype_ops pipe_dump_ops;
static inline u32 pipe_id(const struct fd_parms *p)
diff --git a/criu/pipes.c b/criu/pipes.c
index b458c6b..ad738ef 100644
--- a/criu/pipes.c
+++ b/criu/pipes.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <sys/mman.h>
+#include "crtools.h"
#include "imgset.h"
#include "image.h"
#include "files.h"
@@ -94,7 +95,7 @@ int collect_pipe_data(int img_type, struct pipe_data_rst **hash)
}
/* Choose who will restore a pipe. */
-void mark_pipe_master(void)
+static int mark_pipe_master(void *unused)
{
LIST_HEAD(head);
@@ -157,6 +158,7 @@ void mark_pipe_master(void)
}
list_splice(&head, &pipes);
+ return 0;
}
static struct pipe_data_rst *pd_hash_pipes[PIPE_DATA_HASH_SIZE];
@@ -395,6 +397,10 @@ int collect_one_pipe_ops(void *o, ProtobufCMessage *base, struct file_desc_ops *
list_add(&pi->pipe_list, &tmp->pipe_list);
}
+ if (list_empty(&pipes))
+ if (add_post_prepare_cb(mark_pipe_master, NULL))
+ return -1;
+
list_add_tail(&pi->list, &pipes);
return 0;
--
2.5.0
More information about the CRIU
mailing list