• Pavel Emelyanov's avatar
    restore: Introduce the --restore-sibling option · 53957fad
    Pavel Emelyanov authored
    We have a slight mess with how criu restores root task.
    Right now we have the following options.
    
    1) CLI
    	a) Usually
    	task calling criu
    	 `- criu
    	     `- root restored task
    
    	b) when --restore-detached AND root has pdeath_sig
    
    	task calling criu
    	 `- criu
    	 `- root restored task
    
    2) Library/SWRK
    	task using lib/swrk
    	 `- criu
    	 `- root restored task
    
    3) Standalone service
    	a) Usually
    	service
    	 `- service sub task
    	     `- root restored task
    
    	b) when root has pdeath_sig
    	criu service
    	 `- criu sub task
    	 `- root restored task
    
    It would be better is CRIU always restored the root task as sibling,
    but we have 3 constraints:
    
    First, the case 1.a is kept for zdtm to run tests in pid namespaces
    on 3.11, which in turn doesn't allow CLONE_PARENT | CLONE_NEWPID.
    
    Second, CLI w/o --restore-detach waits for the restored task to die and
    this behavior can be "expected" already.
    
    Third, in case of standalone service tasks shouldn't become service's
    children.
    
    And I have one "plan". The p.haul project while live migrating tasks
    on destination node starts a service, which uses library/swrk mode. In
    this case the restored processes become p.haul service's kids which is
    also not great.
    
    That said, here's the option called --restore-child that pairs the
    --restore-detach like this:
    
    * detached AND child:
    
    task
     `- criu restore (exits at the end)
     `- root task
    
    The root task will become task's child.
    This will be default to library/swrk.
    This is what LXC needs.
    
    * detach AND !child
    
    task
     `- criu restore (exits at the end)
         `- root task
    
    The root task will get re-parented to init.
    This will be compatible with 1.3.
    This will be default to standalone service and
    to my wish with the p.haul case.
    
    * !detach AND child
    
    task
     `- criu restore (waits for root task to die)
     `- root task
    
    This should be deprecated, so that criu restore doesn't mess
     with task <-> root task signalling.
    
    * !detach AND !child
    
    task
     `- criu restore (waits for root task to die)
         `- root task
    
    This is how plain criu restore works now.
    Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    Acked-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
    Acked-by: 's avatarAndrew Vagin <avagin@openvz.org>
    53957fad
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
contrib Loading commit data...
include Loading commit data...
lib Loading commit data...
pie Loading commit data...
protobuf Loading commit data...
scripts Loading commit data...
test Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Makefile Loading commit data...
Makefile.config Loading commit data...
Makefile.crtools Loading commit data...
Makefile.inc Loading commit data...
README Loading commit data...
action-scripts.c Loading commit data...
cgroup.c Loading commit data...
cr-check.c Loading commit data...
cr-dedup.c Loading commit data...
cr-dump.c Loading commit data...
cr-exec.c Loading commit data...
cr-restore.c Loading commit data...
cr-service.c Loading commit data...
cr-show.c Loading commit data...
crtools Loading commit data...
crtools.c Loading commit data...
eventfd.c Loading commit data...
eventpoll.c Loading commit data...
fifo.c Loading commit data...
file-ids.c Loading commit data...
file-lock.c Loading commit data...
files-ext.c Loading commit data...
files-reg.c Loading commit data...
files.c Loading commit data...
fsnotify.c Loading commit data...
image-desc.c Loading commit data...
image.c Loading commit data...
ipc_ns.c Loading commit data...
irmap.c Loading commit data...
kcmp-ids.c Loading commit data...
kerndat.c Loading commit data...
libnetlink.c Loading commit data...
log.c Loading commit data...
mem.c Loading commit data...
mount.c Loading commit data...
namespaces.c Loading commit data...
net.c Loading commit data...
netfilter.c Loading commit data...
page-pipe.c Loading commit data...
page-read.c Loading commit data...
page-xfer.c Loading commit data...
pagemap-cache.c Loading commit data...
parasite-syscall.c Loading commit data...
pipes.c Loading commit data...
plugin.c Loading commit data...
proc_parse.c Loading commit data...
protobuf-desc.c Loading commit data...
protobuf.c Loading commit data...
pstree.c Loading commit data...
ptrace.c Loading commit data...
rbtree.c Loading commit data...
rst-malloc.c Loading commit data...
sd-daemon.c Loading commit data...
sd-daemon.h Loading commit data...
security.c Loading commit data...
shmem.c Loading commit data...
sigframe.c Loading commit data...
signalfd.c Loading commit data...
sk-inet.c Loading commit data...
sk-netlink.c Loading commit data...
sk-packet.c Loading commit data...
sk-queue.c Loading commit data...
sk-tcp.c Loading commit data...
sk-unix.c Loading commit data...
sockets.c Loading commit data...
stats.c Loading commit data...
string.c Loading commit data...
sysctl.c Loading commit data...
sysfs_parse.c Loading commit data...
timerfd.c Loading commit data...
tty.c Loading commit data...
tun.c Loading commit data...
util.c Loading commit data...
uts_ns.c Loading commit data...