@@ -1092,38 +1092,28 @@ func (c *linuxContainer) criuSwrk(process *Process, req *criurpc.CriuReq, opts *
10921092 continue
10931093 case t == criurpc .CriuReqType_RESTORE :
10941094 case t == criurpc .CriuReqType_DUMP :
1095- break
10961095 case t == criurpc .CriuReqType_PRE_DUMP :
1097- // In pre-dump mode CRIU is in a loop and waits for
1098- // the final DUMP command.
1099- // The current runc pre-dump approach, however, is
1100- // start criu in PRE_DUMP once for a single pre-dump
1101- // and not the whole series of pre-dump, pre-dump, ...m, dump
1102- // If we got the message CriuReqType_PRE_DUMP it means
1103- // CRIU was successful and we need to forcefully stop CRIU
1104- logrus .Debugf ("PRE_DUMP finished. Send close signal to CRIU service" )
1105- criuClient .Close ()
1106- // Process status won't be success, because one end of sockets is closed
1107- _ , err := cmd .Process .Wait ()
1108- if err != nil {
1109- logrus .Debugf ("After PRE_DUMP CRIU exiting failed" )
1110- return err
1111- }
1112- return nil
11131096 default :
11141097 return fmt .Errorf ("unable to parse the response %s" , resp .String ())
11151098 }
11161099
11171100 break
11181101 }
11191102
1103+ syscall .Shutdown (fds [0 ], syscall .SHUT_WR )
11201104 // cmd.Wait() waits cmd.goroutines which are used for proxying file descriptors.
11211105 // Here we want to wait only the CRIU process.
11221106 st , err := cmd .Process .Wait ()
11231107 if err != nil {
11241108 return err
11251109 }
1126- if ! st .Success () {
1110+
1111+ // In pre-dump mode CRIU is in a loop and waits for
1112+ // the final DUMP command.
1113+ // The current runc pre-dump approach, however, is
1114+ // start criu in PRE_DUMP once for a single pre-dump
1115+ // and not the whole series of pre-dump, pre-dump, ...m, dump
1116+ if ! st .Success () && * req .Type != criurpc .CriuReqType_PRE_DUMP {
11271117 return fmt .Errorf ("criu failed: %s\n log file: %s" , st .String (), logPath )
11281118 }
11291119 return nil
0 commit comments