mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-25 19:14:04 +00:00
unux: postpone dumping sockets v2
Unix sockets are dumped, when a peer socket is found. We are going to dump external sockets with help plugins. For the we need to set the USK_CALLBACK flags in unix entry. Currently a socket is dumped immediately when it's transfered, but we can be sure that a socket is not external, only when we have its peer. v2: add comments in code Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
59162cccf7
commit
afc61ba562
1 changed files with 13 additions and 1 deletions
14
sk-unix.c
14
sk-unix.c
|
|
@ -324,7 +324,13 @@ dump:
|
|||
pr_info("Dumping unix socket at %d\n", p->fd);
|
||||
show_one_unix("Dumping", sk);
|
||||
|
||||
if (write_unix_entry(sk))
|
||||
/*
|
||||
* Postpone writing the entry if a peer isn't found yet.
|
||||
* It's required, because we may need to modify the entry.
|
||||
* For example, if a socket is external and is dumped by
|
||||
* a callback, the USK_CALLBACK flag must be set.
|
||||
*/
|
||||
if (list_empty(&sk->peer_node) && write_unix_entry(sk))
|
||||
goto err;
|
||||
|
||||
list_del_init(&sk->list);
|
||||
|
|
@ -335,6 +341,9 @@ dump:
|
|||
psk = list_first_entry(&sk->peer_list, struct unix_sk_desc, peer_node);
|
||||
close_safe(&psk->fd);
|
||||
list_del_init(&psk->peer_node);
|
||||
|
||||
if (write_unix_entry(psk))
|
||||
goto err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -559,6 +568,9 @@ int fix_external_unix_sockets(void)
|
|||
psk = list_first_entry(&sk->peer_list, struct unix_sk_desc, peer_node);
|
||||
close_safe(&psk->fd);
|
||||
list_del_init(&psk->peer_node);
|
||||
|
||||
if (write_unix_entry(psk))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue