[CRIU] [PATCH 17/28] files: Add task link to created fdinfo_list_entry and populate it
Kirill Tkhai
ktkhai at virtuozzo.com
Mon Jun 5 20:25:57 MSK 2017
This will be used in further to determine whether task's namespace
allows to restore file_desc.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/files.c | 6 ++++++
criu/include/files.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/criu/files.c b/criu/files.c
index eeb53271e..bbf3edae8 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -696,6 +696,12 @@ static struct fdinfo_list_entry *alloc_fle(int pid, FdinfoEntry *fe)
fle->fe = fe;
fle->received = 0;
fle->stage = FLE_INITIALIZED;
+ fle->task = pstree_item_by_virt(pid);
+ if (!fle->task) {
+ pr_err("Can't find task with pid %d\n", pid);
+ shfree_last(fle);
+ return NULL;
+ }
return fle;
}
diff --git a/criu/include/files.h b/criu/include/files.h
index ef351b7e2..3fe3149f2 100644
--- a/criu/include/files.h
+++ b/criu/include/files.h
@@ -74,6 +74,7 @@ struct fdinfo_list_entry {
struct list_head desc_list; /* To chain on @fd_info_head */
struct file_desc *desc; /* Associated file descriptor */
struct list_head ps_list; /* To chain per-task files */
+ struct pstree_item *task;
int pid;
FdinfoEntry *fe;
u8 received:1;
More information about the CRIU
mailing list