Fix race condition in alarm lock processing noticed by Richard Sharpe <realrichardsha...
commit4ac5552f257f59c2853c6dcc1d96758db89fbd4e
authorJeremy Allison <jra@samba.org>
Thu, 8 Jan 2009 18:34:23 +0000 (8 10:34 -0800)
committerKarolin Seeger <kseeger@samba.org>
Mon, 12 Jan 2009 08:38:19 +0000 (12 09:38 +0100)
tree1ce6453e28755c454e73d5edf78985ce3af17081
parent4f8c8a84a39b2fe06e7cdac6bb7dc14d836444a6
Fix race condition in alarm lock processing noticed by Richard Sharpe <realrichardsharpe@gmail.com>.
"It seems to me that if the lock is already held by another process when we
enter this code, there is a race between the timeout and the granting. If
the lock is subsequently granted, the process releasing the lock will signal
the wait variable (or whatever) and our process will be scheduled. However,
if the timeout occurs before we are scheduled, the timeout will be delivered
first.

We will have the lock but will forget we have the lock, and never release
it."
Jeremy.
(cherry picked from commit 92c251ace583391ea1540f0ae455399f8a75cecf)
source/lib/util_tdb.c