[CRIU] [PATCH v5 05/42] files: Make possible task helpers to use shared_fdt_prepare()

Kirill Tkhai ktkhai at virtuozzo.com
Fri May 5 09:13:13 PDT 2017


Next patches will create transport sockets in task helpers.
As helpers are forked using CLONE_FILES, they must resolve
shared fds to create their own service fds. This patch allows
that.

I've digged in the code, and there is no a reason, we need
pid_rst_prio() during choosing of fdt restorer. So, this
case may be safely deleted, which guarantees, that in case
of TASK_HELPER, the restorer of fdt will be parent, i.e.,
no one TASK_HELPER will be restorer of fdt.

v5: New

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/files.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/criu/files.c b/criu/files.c
index 01cd4c0e9..5c2001469 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1195,6 +1195,7 @@ int prepare_fds(struct pstree_item *me)
 		}
 	}
 
+	BUG_ON(current->pid->state == TASK_HELPER);
 	ret = open_fdinfos(me);
 
 	if (rsti(me)->fdt)
@@ -1334,8 +1335,6 @@ int shared_fdt_prepare(struct pstree_item *item)
 	rsti(item)->fdt = fdt;
 	rsti(item)->service_fd_id = fdt->nr;
 	fdt->nr++;
-	if (pid_rst_prio(vpid(item), fdt->pid))
-		fdt->pid = vpid(item);
 
 	return 0;
 }



More information about the CRIU mailing list