1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +03:00

g_lock: Avoid a double call to serverid_exist

If we try to G_LOCK_READ while a G_LOCK_WRITE is active, we do the
serverid_exists call twice. Avoid that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2018-08-13 14:12:47 +02:00
parent a98f09a09d
commit 6b3cc7916b

View File

@ -226,7 +226,8 @@ static NTSTATUS g_lock_trylock(struct db_record *rec, struct server_id self,
g_lock_get_rec(&lck, i, &check_rec);
if (!serverid_exists(&check_rec.pid)) {
if ((check_rec.lock_type == G_LOCK_READ) &&
!serverid_exists(&check_rec.pid)) {
g_lock_rec_del(&lck, i);
modified = true;
}