[CRIU] [PATCH 1/3] Add dump for unnamed unix sockets

Pavel Emelyanov xemul at parallels.com
Wed Jul 29 01:54:03 PDT 2015


On 07/27/2015 07:19 PM, artem.kuzmitskiy at lge.com wrote:
> From: Artem Kuzmitskiy <artem.kuzmitskiy at lge.com>
> 
> Subject: [PATCH 1/3] Add dump for unnamed unix sockets
> 
>  
> 
> Added functionality for dumping unnamed unix sockets.
> 
> when we call CRIU with dump option, for unnamed socket we should pass it
> 
> inode    into --ext-unix-sk. Details about this problem described in
> 
> http://criu.org/External_UNIX_socket#What_to_do_with_socketpair.28.29-s.3F.
> 
> Usage example:
> 
>                 criu dump -D images -o dump.log -v4 --ext-unix-sk=4529709 -t 13506

The patch got screwed up by your mailer, tabs turned into spaces,
double newlines appeared. Plz, fix. And more comments inline.


> @@ -1421,8 +1421,10 @@ bool inherited_fd(struct file_desc *d, int *fd_p)
> 
>                                return true;
> 
>  
> 
>                *fd_p = dup(i_fd);
> 
> -              if (*fd_p < 0)
> 
> +             if (*fd_p < 0) {
> 
>                                pr_perror("Inherit fd DUP failed");
> 
> +                             return false;
> 
> +             }

This deserves separate patch.

> 
>                else
> 
>                                pr_info("File %s will be restored from fd %d duped "
> 
>                                                                "from inherit fd %d\n", id_str, *fd_p, i_fd);
> 

> 
> @@ -25,49 +25,54 @@ message cgroup_root {
> 
>                required string                  path       = 2;
> 
> };
> 
>  
> 
> +message unix_sk {
> 
> +             required uint32                 inode    = 1;
> 
> +};
> 
> +
> 
> message criu_opts {
> 
>                required int32                                   images_dir_fd   = 1;
> 
>                optional int32                                    pid                          = 2; /* if not set on dump, will dump requesting process */
> 
>  
> 
>                optional bool                                     leave_running   = 3;
> 
>                optional bool                                     ext_unix_sk       = 4;
> 
> -              optional bool                                     tcp_established                = 5;
> 
> -              optional bool                                     evasive_devices               = 6;
> 
> -              optional bool                                     shell_job             = 7;
> 
> -              optional bool                                     file_locks             = 8;
> 
> -              optional int32                                    log_level              = 9 [default = 2];
> 
> -              optional string                                   log_file= 10; /* No subdirs are allowed. Consider using work-dir */
> 
> +             repeated unix_sk                unix_sk_ino     = 5;

You can't renumber fields in proto files, this would break backward compatibility.
Just add new fields at the end of the message with new number.

> 
> +             optional bool                                     tcp_established                = 6;
> 
> +             optional bool                                     evasive_devices               = 7;
> 
> +             optional bool                                     shell_job             = 8;
> 
> +             optional bool                                     file_locks             = 9;
> 
> +             optional int32                                    log_level              = 10 [default = 2];
> 
> +             optional string                                   log_file= 11; /* No subdirs are allowed. Consider using work-dir */
> 
>  
> 

-- Pavel



More information about the CRIU mailing list