2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-25 19:38:38 +00:00
criu/images/sk-unix.proto
Andrey Vagin dcf688b0d6 unix: restore sockets on correct mount points
Currently we restore all sockets in the root mount namespace, because we
were not able to get any information about a mount point where a socket
is bound. It is obviously incorrect in some cases.

In 4.10 kernel, we added the SIOCUNIXFILE ioctl for unix sockets.  This
ioctl opens a file to which a socket is bound and returns a file
descriptor.

This new ioctl allows us to get mnt_id by reading fdinfo, and mnt_id
is enough to find a proper mount point and a mount namespace.

The logic of this patch is straight forward. On dump, we save mnt_id for
sockets, on restore we find a mount namespace by mnt_id and restore this
socket in its mount namespace.

Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-03-23 00:51:37 +03:00

55 lines
1.4 KiB
Protocol Buffer

syntax = "proto2";
import "opts.proto";
import "fown.proto";
import "sk-opts.proto";
message file_perms_entry {
required uint32 mode = 1;
required uint32 uid = 2;
required uint32 gid = 3;
}
message unix_sk_entry {
/*
* Few words about why we need both -- id and ino.
*
* The former one is used to link file descriptor from
* fdinfo image with the unix_sk_entry that should be
* opened under it.
*
* The latter one ties together unix peers -- the peer
* member on this structure is the ino one of its peer
* and simetimes vise-versa.
*/
required uint32 id = 1;
required uint32 ino = 2;
required uint32 type = 3 [(criu).dict = "sk"];
required uint32 state = 4 [(criu).dict = "sk"];
required uint32 flags = 5 [(criu).hex = true];
required uint32 uflags = 6 [(criu).hex = true];
required uint32 backlog = 7;
required uint32 peer = 8;
required fown_entry fown = 9;
required sk_opts_entry opts = 10;
/*
* Abstract name may contain \0 at any point,
* so we need to carry it as byte sequence...
*/
required bytes name = 11 [(criu).conv = "unix_name"];
optional sk_shutdown shutdown = 12;
optional file_perms_entry file_perms = 13;
/*
* Relative socket name may have prefix.
*/
optional string name_dir = 14;
optional bool deleted = 15;
optional uint32 ns_id = 16;
optional sint32 mnt_id = 17 [default = -1];
}