Retry rename on lock induced failures (re-fix) (#16461)

Unfortunately #16435 asserts the wrong error and should use
os.LinkError not os.PathError.

Fix #16439

Signed-off-by: Andrew Thornton <art27@cantab.net>
tokarchuk/v1.17
zeripath 3 years ago committed by GitHub
parent 6d8648ce06
commit b08e14bbcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/util/remove.go

@ -64,7 +64,7 @@ func Rename(oldpath, newpath string) error {
if err == nil { if err == nil {
break break
} }
unwrapped := err.(*os.PathError).Err unwrapped := err.(*os.LinkError).Err
if unwrapped == syscall.EBUSY || unwrapped == syscall.ENOTEMPTY || unwrapped == syscall.EPERM || unwrapped == syscall.EMFILE || unwrapped == syscall.ENFILE { if unwrapped == syscall.EBUSY || unwrapped == syscall.ENOTEMPTY || unwrapped == syscall.EPERM || unwrapped == syscall.EMFILE || unwrapped == syscall.ENFILE {
// try again // try again
<-time.After(100 * time.Millisecond) <-time.After(100 * time.Millisecond)

Loading…
Cancel
Save