Using inotifywait to wait on a mutex does not work reliably when the mutex
is on an NFS and the processes synchronizing on it are running on different
machines.
This commit changes the implementations of mutex and wmutex back to use
sleep instead of inotifywait.
local -i timeout="$2"
while ! mutex_trylock "$lock"; do
- # We can't inotifywait on symlinks. Which is
- # fine because when the symlink is removed, the
- # containing directory is changed. Hence, we can
- # watch the containing directory instead.
-
- if ! inotifywait -qq "${lock%/*}" -t "$timeout"; then
+ if (( --timeout < 0 )); then
return 1
fi
+
+ sleep 1
done
return 0
local -i timeout="$2"
while ! wmutex_trylock "$lock"; do
- if ! inotifywait -qq "${lock%/*}" -t "$timeout"; then
+ if (( --timeout < 0 )); then
return 1
fi
+
+ sleep 1
done
return 0