No description
Find a file
Pavel Emelyanov c5eb61e866 Unix sockets initial support
Currently it can only work with stream sockets, which have no skbs in queues
(listening or established -- both work OK).

The cpt part uses the sock_diag engine that was merged to Dave recently to
collect sockets. Then it dumps sockets by checking the filesystem ID of a
failed-to-open through /proc/pid/fd descriptors (sockets do not allow for
such tricks with opens through proc) against SOCKFS_TYPE.

The rst part is more tricky. Listen sockets are just restored, this is simple.
Connected sockets are restored like this:

1. One end establishes a listening anon socket at the desired descriptor;
2. The other end just creates a socket at the desired descriptor;
3. All sockets, that are to be connect()-ed call connect. Unix sockets
   do not block connect() till the accept() time and thus we continue with...
4. ... all listening sockets call accept() and ... dup2 the new fd into the
   accepting end.

There's a problem with this approach -- socket names are not preserved, but
looking into our OpenVZ implementation I think this is OK for existing apps.

What should be done next is:

1. Need to merge the file IDs patches in our tree and make Andrey to
   support files sharing. This will solve the

	sk = socket();
	fork();

   case. Currently it simply doesn't work :(

2. Need to add support for DGRAM sockets -- I wrote comment how to do it
   in the can_dump_unix_sk()

3. Need to add support for in-flight connections

4. Implement support for UDP sockets (quite simple)

5. Implement support for listening TCP sockets (also not very complex)

6. Implement support for connected TCP scokets (hard one, Tejun's patches are not
   very good for this from my POV)

Cyrill, plz, apply this patch and put the above descriptions onto wiki docs (do we
have the plans page yet?).

Andrey, plz, take care of unix sockets tests in zdtm. Most likely it won't work till
you do the shared files support for sockets.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 23:25:04 +04:00
include Unix sockets initial support 2011-12-26 23:25:04 +04:00
test test: Enhance pthreads test to include fork calls 2011-12-26 02:24:56 +04:00
.gitignore Add crtools into gitignore 2011-09-29 16:04:04 +04:00
COPYING Add COPYING file 2011-12-05 14:11:05 +04:00
cr-dump.c Unix sockets initial support 2011-12-26 23:25:04 +04:00
cr-restore.c Unix sockets initial support 2011-12-26 23:25:04 +04:00
cr-show.c Unix sockets initial support 2011-12-26 23:25:04 +04:00
crtools.c Unix sockets initial support 2011-12-26 23:25:04 +04:00
gen-offsets.sh Initial commit 2011-09-23 12:00:45 +04:00
libnetlink.c Unix sockets initial support 2011-12-26 23:25:04 +04:00
log.c log: Drop unneeded #includes 2011-12-19 23:22:31 +04:00
Makefile Unix sockets initial support 2011-12-26 23:25:04 +04:00
parasite-syscall.c Move everything related to ptrace into ptrace.[ch] 2011-12-19 21:57:59 +04:00
parasite.c parasite: Make max size for path being PATH_MAX 2011-12-19 15:34:37 +04:00
parasite.lds.S Initial commit 2011-09-23 12:00:45 +04:00
ptrace.c ptrace: Drop unneeded #includes 2011-12-19 23:25:08 +04:00
README Drop kernel/ directory 2011-12-20 16:56:04 +04:00
restorer.c restorer: last_pid_ns should be written without eol 2011-12-26 02:25:06 +04:00
sockets.c Unix sockets initial support 2011-12-26 23:25:04 +04:00
TODO Update TODO 2011-11-22 14:36:00 +04:00
util.c Helper for moving image fd 2011-12-26 21:53:44 +04:00

crtools
=======

An utility to checkpoint/restore tasks.

Some code snippets are borrowed from

 - Linux kernel (http://kernel.org/)
 - git (http://git-scm.com/)
 - kvm-tools (https://github.com/penberg/linux-kvm)
 - ptrace-parasite (https://code.google.com/p/ptrace-parasite/)

Many thanks to these projects.

Licensed under GPLv2 (http://www.gnu.org/licenses/gpl-2.0.txt)

Kernel patching
===============

To have crtools up and running clone

	git://github.com/cyrillos/linux-2.6.git

and switch to branch "crtools".

It's based on Linux

commit 384703b8e6cd4c8ef08512e596024e028c91c339
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Fri Dec 16 18:36:26 2011 -0800

    Linux 3.2-rc6