[CRIU] [PATCH 18/19] files: Allow to send unix sockets over unix sockets
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Jan 30 18:43:32 MSK 2018
Everything is ready. Message queue restores are in
the second stage of open for all types of unix sockets.
We just need to make scm wait before restore_unix_queue()
and allow to dump such scm context.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/sk-queue.c | 9 ---------
criu/sk-unix.c | 12 ++++++------
2 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/criu/sk-queue.c b/criu/sk-queue.c
index 7f5aa1d58..b5fb6b76c 100644
--- a/criu/sk-queue.c
+++ b/criu/sk-queue.c
@@ -100,15 +100,6 @@ static int dump_scm_rights(struct cmsghdr *ch, SkPacketEntry *pe)
if (dump_my_file(fds[i], &scme->rights[i], &ftyp))
return -1;
-
- /*
- * Unix sent over Unix are tricky and not supported
- * for now. (XXX -- todo).
- */
- if (ftyp == FD_TYPES__UNIXSK) {
- pr_err("Can't dump send %d (unix/epoll) fd\n", ftyp);
- return -1;
- }
}
i = pe->n_scm++;
diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 10ef327cc..6bc41773e 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -1123,6 +1123,9 @@ static int post_open_standalone(struct file_desc *d, int fd)
BUG_ON((ui->flags & (USK_PAIR_MASTER | USK_PAIR_SLAVE)) ||
(ui->ue->uflags & (USK_CALLBACK | USK_INHERIT)));
+ if (chk_restored_scms(ui))
+ return 1;
+
peer = ui->peer;
if (!peer || ui->is_connected)
goto restore_sk_common;
@@ -1292,6 +1295,9 @@ static int post_open_interconnected_master(struct unix_sk_info *ui)
fle_peer = file_master(&peer->d);
BUG_ON(fle->task != fle_peer->task); /* See interconnected_pair() */
+ if (chk_restored_scms(ui) || chk_restored_scms(peer))
+ return 0;
+
if (restore_unix_queue(fle->fe->fd, peer))
return -1;
@@ -1563,12 +1569,6 @@ static int open_unix_sk(struct file_desc *d, int *new_fd)
ui = container_of(d, struct unix_sk_info, d);
- /* FIXME -- only queue restore may be postponed */
- if (chk_restored_scms(ui)) {
- pr_info("scm: Wait for tgt to restore\n");
- return 1;
- }
-
if (inherited_fd(d, new_fd)) {
ui->ue->uflags |= USK_INHERIT;
ret = *new_fd >= 0 ? 0 : -1;
More information about the CRIU
mailing list