ctdb-daemon: Fix implementation of process_exists control
authorAmitay Isaacs <amitay@gmail.com>
Fri, 25 Aug 2017 05:00:59 +0000 (15:00 +1000)
committerAmitay Isaacs <amitay@samba.org>
Sat, 9 Sep 2017 08:53:10 +0000 (10:53 +0200)
Only check processes that are CTDB clients.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13012

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_daemon.c

index 41f042ecd8446cbd3022222b956c51b62291cf94..7fceed0a2393de983ebc760ae2ea97d360186d94 100644 (file)
@@ -1754,12 +1754,16 @@ int32_t ctdb_control_process_exists(struct ctdb_context *ctdb, pid_t pid)
 {
         struct ctdb_client *client;
 
-       if (ctdb->nodes[ctdb->pnn]->flags & (NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) {
-               client = ctdb_find_client_by_pid(ctdb, pid);
-               if (client != NULL) {
-                       DEBUG(DEBUG_NOTICE,(__location__ " Killing client with pid:%d on banned/stopped node\n", (int)pid));
-                       talloc_free(client);
-               }
+       client = ctdb_find_client_by_pid(ctdb, pid);
+       if (client == NULL) {
+               return -1;
+       }
+
+       if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_INACTIVE) {
+               DEBUG(DEBUG_NOTICE,
+                     ("Killing client with pid:%d on banned/stopped node\n",
+                      (int)pid));
+               talloc_free(client);
                return -1;
        }