Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Tikhomirov <ptikhomirov@virtuozzo.com>2022-06-09 12:17:06 +0300
committerAndrei Vagin <avagin@gmail.com>2022-06-13 08:34:23 +0300
commitbaa4516e626453eb10336af06b725a07818210b4 (patch)
tree4aff5c51a60dedc57c4352abe538438e9eed0f45
parent0db600d91cabebd28215ae2da1f7878bcaa5a9c8 (diff)
sk-unix: make add_fake_unix_queuers earier and rework find_queuer_for
Before this patch, if we had a unixsk with incomming scm packets (with fds) and with the sender side fd closed, we got an error: Error (criu/sk-unix.c:1125): unix: Can't find sender for 0x1e First part of the problem is that unix_note_scm_rights() expects to see a "queuer" which would send scm packets to the unixsk, and there is no as the sender side is closed. Second part of the problem is that we already have "fake" queuers feature so that it already creates a unix socket pair and leaves other end open for later queuing packets. But function add_fake_unix_queuers() is called after unix_note_scm_rights() thus there is no chance to find queuer at the point of failure. Third part is that when we look for a queuer in find_queuer_for() we actually look for a socket for which we are a queuer and not for the socket which is a queuer for us, which is opposite to the name. For cases where both ends are alive both are queuers for each other so this was not important, but for our closed sender case it breaks. So let's reorder add_fake_unix_queuers() before unix_note_scm_rights() and make find_queuer_for() actually do what it's name implies. This situation is started to reproduce on Virtuozzo start/stop tests with the unixsk belonging to systemd, we suppose that this state where the sender fd side is closed happens rarely only on systemd start/stop, so we don't see it in regular suspend resume of long-living containers. Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
-rw-r--r--criu/cr-restore.c8
-rw-r--r--criu/sk-unix.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 9853c0585..398faf048 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -351,6 +351,10 @@ static int root_prepare_shared(void)
if (ret)
goto err;
+ ret = add_fake_unix_queuers();
+ if (ret)
+ goto err;
+
/*
* This should be called with all packets collected AND all
* fdescs and fles prepared BUT post-prep-s not run.
@@ -367,10 +371,6 @@ static int root_prepare_shared(void)
if (ret)
goto err;
- ret = add_fake_unix_queuers();
- if (ret)
- goto err;
-
show_saved_files();
err:
return ret;
diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index c6021bc1f..47e1b2962 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -1021,8 +1021,8 @@ static struct unix_sk_info *find_queuer_for(int id)
struct unix_sk_info *ui;
list_for_each_entry(ui, &unix_sockets, list) {
- if (ui->queuer && ui->queuer->ue->id == id)
- return ui;
+ if (ui->queuer && ui->ue->id == id)
+ return ui->queuer;
}
return NULL;