[CRIU] Criu mod to restore files to state when checkpoint taken ...

"Mark O'Neill" mao at tumblingdice.co.uk
Wed Dec 31 04:53:19 PST 2014


Hi All

I have been busy buidling Criu for Centos 6.5 (Linux 3.18.1) and
eventually managed to get the system to build. There seem to be a few
problems which are not well described on the Criu website - at least
for this OS/Kernel combination:

1. You need to manually copy blk_types.h & compiler.h from the include
tree in the (3.18.1) source tree to /usr/include/linux.

2. You need to hack /usr/include/linux/socket.h adding typedef
unsigned short sa_family_t; (or the build process will generate
errors).

3. The required kernel functions (described on Criu website) must be
added as modules (-=m) and not hardwired into kernel (=y) in Linux
config file.

In addition, I didn't really like the behaviour exhibited by the
system when the file size of open files changes (error). I have
produced the following modification in files-reg.c which simply
truncates files to the size they were when a checkpoint was taken (I
suppose this behaviour could be made optional). With this mod. criu
simply re-instates everything to the way it was when the checkpoint
was taken (as opposed to throwing an error). I have included line
numbers so you can see where it fits into files-reg.c:

Regard

Mark O'Neill

-------------------------------------------------------------

    979                 if (st.st_size != rfi->rfe->size) {
    980
    981                         // MAO - truncate the file to the size
    982                         // at time of checkpoint if possible
    983
    984                         if(st.st_size < rfi->rfe->size) {
    985                                 pr_err("File %s has bad size
%"PRIu64" (expect %"PRIu64")\n",
    986                                         rfi->path, st.st_size,
    987                                         rfi->rfe->size);
    988
    989                                 return -1;
    990                         } else if(st.st_size > rfi->rfe->size)
{
    991                                 ftruncate(tmp,
rfi->rfe->size);
    992                         }
    993                 }

-------------------------------------------------------------



More information about the CRIU mailing list