mirror of
https://github.com/containers/podman.git
synced 2025-10-17 19:24:04 +08:00
libpod: stats catch ErrStatCgroup
Stat() actually ignored ENOENT errors so there is no point in matching them, instead of Stat() does not find a valid cgroup file it returns ErrStatCgroup so match that instead. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -38,7 +38,7 @@ func (c *Container) getPlatformContainerStats(stats *define.ContainerStats, prev
|
||||
if err != nil {
|
||||
// cgroup.Stat() is not an atomic operation, so it is possible that the cgroup is removed
|
||||
// while Stat() is running. Try to catch this case and return a more specific error.
|
||||
if (errors.Is(err, unix.ENOENT) || errors.Is(err, unix.ENODEV)) && !cgroupExist(cgroupPath) {
|
||||
if (errors.Is(err, cgroups.ErrStatCgroup) || errors.Is(err, unix.ENODEV)) && !cgroupExist(cgroupPath) {
|
||||
return fmt.Errorf("cgroup %s does not exist: %w", cgroupPath, define.ErrCtrStopped)
|
||||
}
|
||||
return fmt.Errorf("unable to obtain cgroup stats: %w", err)
|
||||
|
Reference in New Issue
Block a user