Skip to content

Commit 2cbf075

Browse files
authored
Merge pull request #6570 from fuweid/cp-6452
[release/1.5] runc.v1/v2: return init pid when clean dead shim
2 parents 6ddbd47 + 6f45108 commit 2cbf075

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

runtime/v2/runc/v1/service.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build linux
12
// +build linux
23

34
/*
@@ -247,9 +248,16 @@ func (s *service) Cleanup(ctx context.Context) (*taskAPI.DeleteResponse, error)
247248
if err := mount.UnmountAll(filepath.Join(path, "rootfs"), 0); err != nil {
248249
logrus.WithError(err).Warn("failed to cleanup rootfs mount")
249250
}
251+
252+
pid, err := runcC.ReadPidFile(filepath.Join(path, process.InitPidFile))
253+
if err != nil {
254+
logrus.WithError(err).Warn("failed to read init pid file")
255+
}
256+
250257
return &taskAPI.DeleteResponse{
251258
ExitedAt: time.Now(),
252259
ExitStatus: 128 + uint32(unix.SIGKILL),
260+
Pid: uint32(pid),
253261
}, nil
254262
}
255263

runtime/v2/runc/v2/service.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build linux
12
// +build linux
23

34
/*
@@ -321,9 +322,16 @@ func (s *service) Cleanup(ctx context.Context) (*taskAPI.DeleteResponse, error)
321322
if err := mount.UnmountAll(filepath.Join(path, "rootfs"), 0); err != nil {
322323
logrus.WithError(err).Warn("failed to cleanup rootfs mount")
323324
}
325+
326+
pid, err := runcC.ReadPidFile(filepath.Join(path, process.InitPidFile))
327+
if err != nil {
328+
logrus.WithError(err).Warn("failed to read init pid file")
329+
}
330+
324331
return &taskAPI.DeleteResponse{
325332
ExitedAt: time.Now(),
326333
ExitStatus: 128 + uint32(unix.SIGKILL),
334+
Pid: uint32(pid),
327335
}, nil
328336
}
329337

0 commit comments

Comments
 (0)