• 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
..
Makefile Loading commit data...
cgroup.proto Loading commit data...
core-aarch64.proto Loading commit data...
core-arm.proto Loading commit data...
core-x86.proto Loading commit data...
core.proto Loading commit data...
creds.proto Loading commit data...
eventfd.proto Loading commit data...
eventpoll.proto Loading commit data...
ext-file.proto Loading commit data...
fdinfo.proto Loading commit data...
fh.proto Loading commit data...
fifo.proto Loading commit data...
file-lock.proto Loading commit data...
fown.proto Loading commit data...
fs.proto Loading commit data...
fsnotify.proto Loading commit data...
ghost-file.proto Loading commit data...
inventory.proto Loading commit data...
ipc-desc.proto Loading commit data...
ipc-msg.proto Loading commit data...
ipc-sem.proto Loading commit data...
ipc-shm.proto Loading commit data...
ipc-var.proto Loading commit data...
mm.proto Loading commit data...
mnt.proto Loading commit data...
netdev.proto Loading commit data...
ns.proto Loading commit data...
packet-sock.proto Loading commit data...
pagemap.proto Loading commit data...
pipe-data.proto Loading commit data...
pipe.proto Loading commit data...
pstree.proto Loading commit data...
regfile.proto Loading commit data...
remap-file-path.proto Loading commit data...
rlimit.proto Loading commit data...
rpc.proto Loading commit data...
sa.proto Loading commit data...
siginfo.proto Loading commit data...
signalfd.proto Loading commit data...
sk-inet.proto Loading commit data...
sk-netlink.proto Loading commit data...
sk-opts.proto Loading commit data...
sk-packet.proto Loading commit data...
sk-unix.proto Loading commit data...
stats.proto Loading commit data...
tcp-stream.proto Loading commit data...
timer.proto Loading commit data...
timerfd.proto Loading commit data...
tty.proto Loading commit data...
tun.proto Loading commit data...
utsns.proto Loading commit data...
vma.proto Loading commit data...