David Powell wrote:
> ...
> ipf_get_lock is racy. A simpler and more robust lock file can be
> created by creating a lockfile.$newpid that contains $newpid and
> attempting to ln $IPF_LOCK to your lockfile.
That still doesn't solve a race condition that involves lockfile.$newpid,
although it does make it less likely to occur.
Normally mkdir is used to get an "atmoic lock" on a path in the
filesystem.
Thus the usual method for getting "exclusive" use of a lock using
file systems "tricks" should do something like:
while ! mkdir $IPF_LOCK; do
sleep 1
done
echo $newpid> $IPF_LOCK/pid
Darren
_______________________________________________
networking-discuss mailing list
[email protected]