tdb: Do lock upgrades properly
authorVolker Lendecke <vl@samba.org>
Mon, 7 Nov 2016 20:40:15 +0000 (21:40 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 10 Apr 2017 18:44:21 +0000 (20:44 +0200)
commita6f1532d7fedc6b6f36b511aebe8998e9452b7ff
tree3faf22d7653210698e40a9562ad02405e75c4c74
parent97cafdcfaaaff17ebffe873b5e31462f0d1268b1
tdb: Do lock upgrades properly

When a process holds a readlock and wants to upgrade, this needs to be
reflected in the underlying lock. Without this, it is possible to cheat:
One process holds a readlock, and another process wants to write this
record. All the writer has to do is take a readonly lock on the key and
then do the store.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/tdb/common/lock.c