[CRIU] [PATCH 09/11] zdtm: add test for new init reparent handling

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri May 26 10:02:52 PDT 2017


Before "pstree: rework init reparent handling for pid namespaces" patch
we would get:

$ ./test/zdtm.py run -t zdtm/static/session01
=== Run 1/1 ================ zdtm/static/session01

======================= Run zdtm/static/session01 in ns ========================
Start test
./session01 --pidfile=session01.pid --outfile=session01.out
Run criu dump
Run criu restore
=[log]=> dump/zdtm/static/session01/31/1/restore.log
------------------------ grep Error ------------------------
(00.001103) 8 was born with sid 4
(00.001105) 7 was born with sid 4
(00.001106) 21 was born with sid 17
(00.001108) 1 was born with sid 17
(00.001109) Error (criu/pstree.c:1005): Can't find a session leader for 17
------------------------ ERROR OVER ------------------------

Corresponding tree before dump:
(combined 'pstree -pS 1' and 'ps axf -o pid,ppid,sid')

session01(1, 0, 1)─┬─session01(3, 1, 1)───session01(4, 3, 4)─┬─session01(5, 4, 5)─┬─session01(23, 5, 5)
                   │                                         │                    ├─session01(24, 5, 5)
                   │                                         │                    └─session01(26, 5, 5)
                   │                                         ├─session01(6, 4, 4)
                   │                                         ├─session01(7, 4, 7)───session01(16, 7, 4)
                   │                                         └─session01(8, 4, 8)───session01(15, 8, 15)───session01(20, 15, 4)
                   ├─session01(12, 1, 12)───session01(17, 12, 17)───session01(18, 17, 18)───session01(27, 18, 4)
                   ├─session01(13, 1, 10)
                   ├─session01(14, 1, 4)
                   └─session01(21, 1, 21)───session01(22, 21, 17)

22 can not restore as it needs session 17, but 17-th's leader is not in
ancestors(21 had been reparented from 17; 12, 13 an 14 from 4).

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 test/zdtm/static/session01.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/zdtm/static/session01.c b/test/zdtm/static/session01.c
index 155e9a4..bf861c3 100644
--- a/test/zdtm/static/session01.c
+++ b/test/zdtm/static/session01.c
@@ -52,10 +52,18 @@ static struct testcase __testcases[] = {
 	{10,  2, 10,  2, 10, 1 },  /*  |\_session00		*/
 	{11, 10, 11,  2, 11, 1 },  /*  |    \_session00		*/
 	{12, 11,  2,  2,  2, 1 },  /*  |        \_session00	*/
-	{13,  2,  2,  2,  2, 0 },  /*   \_session00		*/
+	{13,  2,  2,  2,  2, 0 },  /*  |\_session00		*/
+	{ 6,  2,  6,  2,  6, 0 },  /*  |\_session00		*/
+	{19,  2, 19,  2, 19, 0 },  /*   \_session00		*/
 	{ 3, 13,  2,  2,  2, 1 },  /* session00			*/
-	{ 6,  2,  6,  2,  6, 0 },  /*   \_session00		*/
 	{14,  6,  6,  6,  6, 1 },  /* session00			*/
+	{7,  19,  7,  2,  7, 1 },  /* session00			*/
+	{20,  7, 20,  2, 20, 1 },  /*   \_session00		*/
+	{21, 20, 21,  2, 21, 1 },  /*    |\_session00		*/
+	{22, 21,  2,  2,  2, 1 },  /*    |  \_session00		*/
+	{23, 20, 23, 20, 23, 0 },  /*     \_session00		*/
+	{24, 23, 24, 20, 24, 1 },  /* session00			*/
+	{25, 24, 20, 20, 20, 1 },  /*   \_session00		*/
 };
 
 #define TESTS (sizeof(__testcases) / sizeof(struct testcase))
-- 
2.9.3



More information about the CRIU mailing list