[CRIU] Re: [PATCH 3/6] pstree: Allow to dump and restore session
non-leaders if --shell-job passed
Pavel Emelyanov
xemul at parallels.com
Tue Oct 16 12:04:00 EDT 2012
On 10/16/2012 11:27 AM, Cyrill Gorcunov wrote:
>
> If --shell-job passed we allow to dump and restpre session non-leaders.
>
> This slightly changes the behaviour or the tool. If previously
> we allowed to dump non-leaders after this commit we refuse to
> do that if not explicitly requested.
>
> Note that in sake of tty restore (which will be addressed in
> further patches) we do inherit process group for root task.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> include/pstree.h | 7 ++++
> pstree.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 89 insertions(+), 2 deletions(-)
>
> + * PID GID SID
> + * 2 2 2 shell
> + * 3 2 2 `- root-task <-- dump from here
> + * 5 2 2 `- task-1
> + * 6 6 2 `- task-2
> + *
> + * PID GID SID
> + * 1 1 1 shell
> + * 3 1 1 `- root-task <-- restore from here
> + * 5 1 1 `- task-1
> + * 6 6 1 `- task-2
> + *
> + * So when we migrate a shell job we need the task-1 to inherit
> + * GID from root task, thus we put INHERIT_PGID in the image.
> + */
> + if (item->pgid == origin_sid)
> + e.pgid = INHERIT_SID;
> + else if (item->pgid == origin_pgid)
> + e.pgid = INHERIT_PGID;
> + else
> + e.pgid = item->pgid;
In the examples above all the pgid-s will be INHERIT_SID. Show me example when
INHERIT_PGID can happen.
More information about the CRIU
mailing list