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

Pavel Emelyanov xemul at parallels.com
Wed Dec 31 05:50:59 PST 2014


On 12/31/2014 03:53 PM, "Mark O'Neill" wrote:
> 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:

Great :)

> 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).

Can you show us what build errors you see?

> 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.

This is strange. What problems have you seen with all-in kernel?

> 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).

Well, this change actually trims the tail from file, so there's no
100% guarantee, that the application would continue working.

But I don't mind fixing CRIU even to ignore the file sizes change on
restore. The only thing I ask for is to put this behavior under the
CLI option.

If you could prepare such a patch (it's described here [1] how to do
it) so I could just commit one into the repository, that'd be awesome.

[1] http://criu.org/How_to_submit_patches

Thanks,
Pavel

> 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                 }
> 
> -------------------------------------------------------------
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> .
> 



More information about the CRIU mailing list