[CRIU] [PATCH v3 06/16] cr-restore: restore root sid before mount namespace
Stanislav Kinsburskiy
skinsbursky at odin.com
Mon Dec 14 03:13:36 PST 2015
14.12.2015 12:07, Pavel Emelyanov пишет:
> On 12/10/2015 06:16 PM, Stanislav Kinsburskiy wrote:
>> This is a precursor patch for AutoFS mount restore.
>> To restore AutoFS indirect mount points, we have to create mount point dentries.
>> This can do only the process with pgrp, configured to mount. Process, which
>> does AutoFS mount call (init) at that moment is not.
>> Restoring actual pgrp before sid breaks sid restoring.
>> Thus, restoring of sid is required to make process group leader.
>>
>> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
>> ---
>> cr-restore.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/cr-restore.c b/cr-restore.c
>> index 1c0c641..8f3d28f 100644
>> --- a/cr-restore.c
>> +++ b/cr-restore.c
>> @@ -1441,7 +1441,10 @@ static int create_children_and_session(void)
>> return ret;
>> }
>>
>> - restore_sid();
>> + if (getpid() == 1)
> The place where you do call restore_sid() (below hunk) happens under
> different check. E.g. for non-container restore you're breaking things.
Ok.
>> + pr_info("Skipping restore_sid() for init\n");
> Not skipping, you've already restored it, so either drop this message
> or print smth like "restored earlier".
Ditto.
>> + else
>> + restore_sid();
>>
>> pr_info("Restoring children in our session:\n");
>> list_for_each_entry(child, ¤t->children, sibling) {
>> @@ -1524,6 +1527,9 @@ static int restore_task_with_children(void *_arg)
>> if (restore_finish_stage(CR_STATE_RESTORE_NS) < 0)
>> goto err;
>>
>> + pr_info("Calling restore_sid() for init\n");
>> + restore_sid();
>> +
>> /*
>> * We need non /proc proc mount for restoring pid and mount
>> * namespaces and do not care for the rest of the cases.
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
>> .
>>
More information about the CRIU
mailing list