Merge pull request #23587 from rhatdan/errors

Additional potential race condition on os.Readdir
This commit is contained in:
openshift-merge-bot[bot]
2024-08-13 10:04:59 +00:00
committed by GitHub

View File

@ -1,7 +1,9 @@
package file package file
import ( import (
"errors"
"fmt" "fmt"
"io/fs"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
@ -138,7 +140,9 @@ func (locks *FileLocks) DeallocateAllLocks() error {
p := filepath.Join(locks.lockPath, f.Name()) p := filepath.Join(locks.lockPath, f.Name())
err := os.Remove(p) err := os.Remove(p)
if err != nil { if err != nil {
lastErr = err if errors.Is(err, fs.ErrNotExist) {
continue
}
logrus.Errorf("Deallocating lock %s", p) logrus.Errorf("Deallocating lock %s", p)
} }
} }