2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

parasite: Always switch netns for transport socket

If we're doing the pre-dump command we don't have the tasks'
IDs collected, so we have the current_ns_mask uninitilized.
Thus we create parasite transport socket in criu's namespace
always and pre-dump of task, sitting in foreing net namespace
may hang.

From the "performance" point of view, it's easier to always
create transport socket in victim's namespace, rahter than
getting the current_ns_mask.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov 2014-01-13 22:14:08 +04:00
parent 75fef9a6fb
commit d9ec409b3f

View File

@ -445,12 +445,9 @@ static int prepare_tsock(struct parasite_ctl *ctl, pid_t pid,
if (ssock == -1) {
int rst = -1;
if (current_ns_mask & CLONE_NEWNET) {
pr_info("Switching to %d's net for tsock creation\n", pid);
if (switch_ns(pid, &net_ns_desc, &rst))
return -1;
}
pr_info("Switching to %d's net for tsock creation\n", pid);
if (switch_ns(pid, &net_ns_desc, &rst))
return -1;
ssock = socket(PF_UNIX, SOCK_SEQPACKET, 0);
if (ssock < 0)