From: Amitay Isaacs Date: Fri, 22 Sep 2017 03:52:09 +0000 (+1000) Subject: ctdb-daemon: Check all connections from a process in CHECK_PID_SRVID control X-Git-Tag: ldb-1.3.0~85 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=e342f1f078fa50904216e6e45fb9b6e40043eb98;p=samba.git ctdb-daemon: Check all connections from a process in CHECK_PID_SRVID control BUG: https://bugzilla.samba.org/show_bug.cgi?id=13042 Signed-off-by: Amitay Isaacs Reviewed-by: Volker Lendecke --- diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 90e8b715bae..c72f41a4b9e 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -1774,7 +1774,7 @@ int32_t ctdb_control_process_exists(struct ctdb_context *ctdb, pid_t pid) int32_t ctdb_control_check_pid_srvid(struct ctdb_context *ctdb, TDB_DATA indata) { - struct ctdb_client *client; + struct ctdb_client_pid_list *client_pid; pid_t pid; uint64_t srvid; int ret; @@ -1782,17 +1782,19 @@ int32_t ctdb_control_check_pid_srvid(struct ctdb_context *ctdb, pid = *(pid_t *)indata.dptr; srvid = *(uint64_t *)(indata.dptr + sizeof(pid_t)); - client = ctdb_find_client_by_pid(ctdb, pid); - if (client == NULL) { - return -1; - } - - ret = srvid_exists(ctdb->srv, srvid, client); - if (ret != 0) { - return -1; + for (client_pid = ctdb->client_pids; + client_pid != NULL; + client_pid = client_pid->next) { + if (client_pid->pid == pid) { + ret = srvid_exists(ctdb->srv, srvid, + client_pid->client); + if (ret == 0) { + return 0; + } + } } - return 0; + return -1; } int ctdb_control_getnodesfile(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata)