diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-07-31 23:11:33 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-07-31 23:11:33 +0000 |
commit | f2ba17db33d7d3c92d622204f58308eb0a85584b (patch) | |
tree | b14a40db321ff0ab4832e1c0936d2c8bcf86ef60 /runsc/cgroup | |
parent | edbaf6199dae93eae2d38347e0e10e4c0efa2bc1 (diff) | |
parent | a7d9aa6d5bfbed11c94578c6a2eb04ce75cbdbe5 (diff) |
Merge release-20200622.1-300-ga7d9aa6d5 (automated)
Diffstat (limited to 'runsc/cgroup')
-rw-r--r-- | runsc/cgroup/cgroup.go | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/runsc/cgroup/cgroup.go b/runsc/cgroup/cgroup.go index e5cc9d622..8fbc3887a 100644 --- a/runsc/cgroup/cgroup.go +++ b/runsc/cgroup/cgroup.go @@ -92,7 +92,17 @@ func setOptionalValueUint16(path, name string, val *uint16) error { func setValue(path, name, data string) error { fullpath := filepath.Join(path, name) - return ioutil.WriteFile(fullpath, []byte(data), 0700) + + // Retry writes on EINTR; see: + // https://github.com/golang/go/issues/38033 + for { + err := ioutil.WriteFile(fullpath, []byte(data), 0700) + if err == nil { + return nil + } else if !errors.Is(err, syscall.EINTR) { + return err + } + } } func getValue(path, name string) (string, error) { @@ -132,8 +142,16 @@ func fillFromAncestor(path string) (string, error) { if err != nil { return "", err } - if err := ioutil.WriteFile(path, []byte(val), 0700); err != nil { - return "", err + + // Retry writes on EINTR; see: + // https://github.com/golang/go/issues/38033 + for { + err := ioutil.WriteFile(path, []byte(val), 0700) + if err == nil { + break + } else if !errors.Is(err, syscall.EINTR) { + return "", err + } } return val, nil } |