From: Jingxian He hejingxian@huawei.com
When there exist multi processes need to dump, the child process may have the same fds as parent process. During the restore processing, criu choose the process which has the min pid value to be the master process to recover fds. However, choosing the parent process as the master process is more suitable.
Conflict:NA Reference:https://gitee.com/src-openeuler/criu/pulls/21 Signed-off-by: Jingxian He hejingxian@huawei.com --- criu/cr-restore.c | 5 ++--- criu/files.c | 7 +------ 2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c index 7ec84c8..6114dd4 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -2068,10 +2068,9 @@ static int restore_task_with_children(void *_arg) return 0;
err: - if (current->parent == NULL) { - do_notifier_rollback(opts.with_notifier_kup, POST_UPDATE_KERNEL_COMPLETE); + do_notifier_rollback(opts.with_notifier_kup, POST_UPDATE_KERNEL_COMPLETE); + if (current->parent == NULL) futex_abort_and_wake(&task_entries->nr_in_progress); - } exit(1); }
diff --git a/criu/files.c b/criu/files.c index 84d6563..10c9661 100644 --- a/criu/files.c +++ b/criu/files.c @@ -925,12 +925,7 @@ static struct fdinfo_list_entry *alloc_fle(int pid, FdinfoEntry *fe)
static void __collect_desc_fle(struct fdinfo_list_entry *new_le, struct file_desc *fdesc) { - struct fdinfo_list_entry *le; - - list_for_each_entry_reverse(le, &fdesc->fd_info_head, desc_list) - if (pid_rst_prio_eq(le->pid, new_le->pid)) - break; - list_add(&new_le->desc_list, &le->desc_list); + list_add_tail(&new_le->desc_list, &fdesc->fd_info_head); }
static void collect_desc_fle(struct fdinfo_list_entry *new_le,