From 774c28416bd05c66f398dfbc999cff0e209b3620 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 22 Aug 2012 12:35:29 +0200 Subject: s3:g_lock: use serverid_exists() with SERVERID_UNIQUE_ID_NOT_TO_VERIFY metze --- source3/lib/g_lock.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source3') diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index 4535b35569..fbd90225f0 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -29,6 +29,7 @@ #include "../lib/util/tevent_ntstatus.h" #include "system/select.h" #include "messages.h" +#include "serverid.h" struct g_lock_ctx { struct db_context *db; @@ -124,8 +125,16 @@ static NTSTATUS g_lock_trylock(struct db_record *rec, struct server_id self, goto done; } if (g_lock_conflicts(type, locks[i].lock_type)) { + struct server_id pid = locks[i].pid; - if (process_exists(locks[i].pid)) { + /* + * As the serverid_exists might recurse into + * the g_lock code, we use + * SERVERID_UNIQUE_ID_NOT_TO_VERIFY to avoid the loop + */ + pid.unique_id = SERVERID_UNIQUE_ID_NOT_TO_VERIFY; + + if (serverid_exists(&pid)) { status = NT_STATUS_LOCK_NOT_GRANTED; goto done; } -- cgit