[CRIU] [PATCH 2/2] remap: add a dead pid /proc remap
Pavel Emelyanov
xemul at parallels.com
Thu Sep 11 03:31:42 PDT 2014
On 09/10/2014 07:51 PM, Tycho Andersen wrote:
> On Wed, Sep 10, 2014 at 07:21:55PM +0400, Pavel Emelyanov wrote:
>>
>>> @@ -227,6 +228,28 @@ static int open_remap_linked(struct reg_file_info *rfi,
>>> return 0;
>>> }
>>>
>>> +static int open_remap_dead_process(struct reg_file_info *rfi,
>>> + RemapFilePathEntry *rfe)
>>> +{
>>> + struct pstree_item *helper;
>>> +
>>> + helper = alloc_pstree_item_with_rst();
>>> + if (!helper)
>>> + return -1;
>>> +
>>> + helper->sid = root_item->sid;
>>> + helper->pgid = root_item->sid;
>>> + helper->pid.virt = rfe->remap_id;
>>
>> BTW, a helper with such pid may already be in the tree. E.g.
>> you have a dead task with pid 20 and living task with pgid 20.
>> In this case CRIU would create a helper with pid 20 to make
>> the pgid restore for the latter one work.
>
> Good point. Another possibility is that two other tasks have the same
> dead pid's files open. This code should check to see if the pid is
> already in the tree as a TASK_HELPER before it adds one, I suppose.
Yes you're right, this is also possible. Maybe this causes the bug
on session test Andrey pointed out.
> Tycho
>
>>> + helper->state = TASK_HELPER;
>>> + helper->parent = root_item;
>>> + list_add_tail(&helper->sibling, &root_item->children);
>>> + task_entries->nr_helpers++;
>>> +
>>> + pr_info("Added a helper for restoring /proc/%d\n", helper->pid.virt);
>>> +
>>> + return 0;
>>> +}
>>> +
>>> static int collect_one_remap(void *obj, ProtobufCMessage *msg)
>>> {
>>> int ret = -1;
>>
>
More information about the CRIU
mailing list