[CRIU] [PATCH 09/10] tty: Introduce deferred dumping of tty peers

Cyrill Gorcunov gorcunov at openvz.org
Fri Oct 26 15:58:02 EDT 2012


The dumping of tty peers is somewhat tricky. And it became more
complex once we allowed to migrate/inherit sessions.

It's being found (in screen c/r) that we've a problem in looking
up of session leaders while dumping tty.

Let me explain with more details. Here is an example of screen
session

  PID   GID   SID
20567 20567 20567           SCREEN
20568 20568 20568  pts/3     \_ /bin/bash

The screen opens master peer (ptmx) and then provides
bash the slave peer (pts/3) where bash sets up a session
leader on it.

Thus we get interesting scenario -- our pstree construction
is done in lazy fashion, we run parasite code to fetch sid/pgid
of a process tree item only when we're really dumping the task.

Thus when we start dumping ptmx peer (which belongs to SCREEN)
we've not yet constructed the process tree item for children
(ie /bin/bash) and the lookup function in tty code (which walks
over all process items in a tree) simply fails to find sid of
child, because we've not yet dumped it.

Thus, to resolve such situation I introduce deferred dumping
of tty peers -- the parameters of a peer met get remembered
in tty code and at the final pass of the dumping we walk over
all tty entried and dump them.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-dump.c     |    3 ++
 include/tty.h |    1 +
 tty.c         |   83 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 3 files changed, 78 insertions(+), 9 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-tty-Introduce-deferred-dumping-of-tty-peers.patch
Type: text/x-patch
Size: 4027 bytes
Desc: not available
Url : http://openvz.org/pipermail/criu/attachments/20121026/e9c4d6dd/0009-tty-Introduce-deferred-dumping-of-tty-peers.bin


More information about the CRIU mailing list