Commit cae94b76 authored by Stanislav Kinsburskiy's avatar Stanislav Kinsburskiy Committed by Pavel Emelyanov

cr-restore: restore root sid before mount namespace

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: 's avatarStanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 5ff22ad2
...@@ -1482,7 +1482,8 @@ static int create_children_and_session(void) ...@@ -1482,7 +1482,8 @@ static int create_children_and_session(void)
return ret; return ret;
} }
restore_sid(); if (current->parent)
restore_sid();
pr_info("Restoring children in our session:\n"); pr_info("Restoring children in our session:\n");
list_for_each_entry(child, &current->children, sibling) { list_for_each_entry(child, &current->children, sibling) {
...@@ -1565,6 +1566,9 @@ static int restore_task_with_children(void *_arg) ...@@ -1565,6 +1566,9 @@ static int restore_task_with_children(void *_arg)
if (restore_finish_stage(CR_STATE_RESTORE_NS) < 0) if (restore_finish_stage(CR_STATE_RESTORE_NS) < 0)
goto err; goto err;
pr_info("Calling restore_sid() for init\n");
restore_sid();
/* /*
* We need non /proc proc mount for restoring pid and mount * We need non /proc proc mount for restoring pid and mount
* namespaces and do not care for the rest of the cases. * namespaces and do not care for the rest of the cases.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment