From e6c222511dec43565d869fd805fce214049e6776 Mon Sep 17 00:00:00 2001 From: zeripath Date: Fri, 16 Jul 2021 17:48:39 +0100 Subject: [PATCH] Retry rename on lock induced failures (re-fix) (#16461) (#16463) Backport #16461 Unfortunately #16435 asserts the wrong error and should use os.LinkError not os.PathError. Fix #16439 Signed-off-by: Andrew Thornton --- modules/util/remove.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/util/remove.go b/modules/util/remove.go index 2310436525..754f3b7c11 100644 --- a/modules/util/remove.go +++ b/modules/util/remove.go @@ -64,7 +64,7 @@ func Rename(oldpath, newpath string) error { if err == nil { 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 { // try again <-time.After(100 * time.Millisecond)