mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 14:55:39 +00:00
uffd: Relax reading the pstree image (v2)
The uffd code only needs the pstree items themselves, not any IDs and relations they might have. travis-ci: success for Some more cleanups over uffd.c (rev3) Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
12c0f452fe
commit
f30cca66ec
@@ -100,6 +100,7 @@ extern struct pstree_item *pstree_item_next(struct pstree_item *item);
|
|||||||
|
|
||||||
extern bool restore_before_setsid(struct pstree_item *child);
|
extern bool restore_before_setsid(struct pstree_item *child);
|
||||||
extern int prepare_pstree(void);
|
extern int prepare_pstree(void);
|
||||||
|
extern int prepare_dummy_pstree(void);
|
||||||
|
|
||||||
extern int dump_pstree(struct pstree_item *root_item);
|
extern int dump_pstree(struct pstree_item *root_item);
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "protobuf.h"
|
#include "protobuf.h"
|
||||||
#include "images/pstree.pb-c.h"
|
#include "images/pstree.pb-c.h"
|
||||||
|
#include "crtools.h"
|
||||||
|
|
||||||
struct pstree_item *root_item;
|
struct pstree_item *root_item;
|
||||||
static struct rb_root pid_root_rb;
|
static struct rb_root pid_root_rb;
|
||||||
@@ -950,6 +951,22 @@ int prepare_pstree(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int prepare_dummy_pstree(void)
|
||||||
|
{
|
||||||
|
pid_t dummy = 0;
|
||||||
|
|
||||||
|
if (check_img_inventory() == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (prepare_task_entries() == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (read_pstree_image(&dummy) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool restore_before_setsid(struct pstree_item *child)
|
bool restore_before_setsid(struct pstree_item *child)
|
||||||
{
|
{
|
||||||
int csid = child->born_sid == -1 ? child->sid : child->born_sid;
|
int csid = child->born_sid == -1 ? child->sid : child->born_sid;
|
||||||
|
17
criu/uffd.c
17
criu/uffd.c
@@ -781,21 +781,6 @@ out:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lazy_pages_prepare_pstree(void)
|
|
||||||
{
|
|
||||||
if (check_img_inventory() == -1)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Allocate memory for task_entries */
|
|
||||||
if (prepare_task_entries() == -1)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (prepare_pstree() == -1)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int prepare_epoll(int nr_fds, struct epoll_event **events)
|
static int prepare_epoll(int nr_fds, struct epoll_event **events)
|
||||||
{
|
{
|
||||||
int epollfd;
|
int epollfd;
|
||||||
@@ -915,7 +900,7 @@ int cr_lazy_pages(bool daemon)
|
|||||||
if (check_for_uffd())
|
if (check_for_uffd())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (lazy_pages_prepare_pstree())
|
if (prepare_dummy_pstree())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
lazy_sk = prepare_lazy_socket();
|
lazy_sk = prepare_lazy_socket();
|
||||||
|
Reference in New Issue
Block a user