From: Sergey Matveev Date: Sat, 4 Jan 2025 12:18:15 +0000 (+0300) Subject: Fix possible NFS locking issue X-Git-Tag: v2.6.4^0 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=43d897846589ea7fbb6d2b0372a9afe84702633c;p=goredo.git Fix possible NFS locking issue Niklas Böhm reported and fixed: I was using goredo on an NFS and noticed that I sometimes ran into issues where my program would fail with the following error: run.go:234: interrupted system call /gpfs01/.../folders/.redo/1.zip.lock After doing some digging, it seems like the problem is that calling unix.FcntlFlock with F_SETLKW can be too slow over an NFS and will get interrupted (see `man 2 flock`, Section on errors [1]). Apparently there is an automatic restart mechanism [2], but it's also unreliable, so I thought it's better to handle it explicitly. [1]: https://www.man7.org/linux/man-pages/man2/fcntl.2.html#ERRORS [2]: https://unix.stackexchange.com/questions/509375/what-is-interrupted-system-call --- diff --git a/doc/news.texi b/doc/news.texi index 6fbd813..4a08a68 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -2,6 +2,15 @@ @cindex news @unnumbered News +@anchor{Release 2_6_4} +@section Release 2.6.4 +@itemize +@item + Fix possible NFS locking issue. +@item + Updated dependant libraries. +@end itemize + @anchor{Release 2_6_3} @section Release 2.6.3 @itemize diff --git a/run.go b/run.go index 506fd35..5423b49 100644 --- a/run.go +++ b/run.go @@ -227,7 +227,7 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error { tracef(CLock, "LOCK_EX: %s", fdLock.Name()) LockAgain: if err = unix.FcntlFlock(fdLock.Fd(), unix.F_SETLKW, &flock); err != nil { - if errors.Is(err, unix.EDEADLK) { + if errors.Is(err, unix.EDEADLK) || errors.Is(err, unix.EINTR) { time.Sleep(10 * time.Millisecond) goto LockAgain } diff --git a/usage.go b/usage.go index dc08f25..67ae2e7 100644 --- a/usage.go +++ b/usage.go @@ -22,7 +22,7 @@ import ( ) const ( - Version = "2.6.3" + Version = "2.6.4" Warranty = `Copyright (C) 2020-2025 Sergey Matveev This program is free software: you can redistribute it and/or modify