]> xenbits.xensource.com Git - libvirt.git/commitdiff
rpc: switch virtlockd and virtlogd to use single-threaded dispatch
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 6 Mar 2018 17:12:20 +0000 (17:12 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 8 Mar 2018 15:40:29 +0000 (15:40 +0000)
Currently both virtlogd and virtlockd use a single worker thread for
dispatching RPC messages. Even this is overkill and their RPC message
handling callbacks all run in short, finite time and so blocking the
main loop is not an issue like you'd see in libvirtd with long running
QEMU commands.

By setting max_workers==0, we can turn off the worker thread and run
these daemons single threaded. This in turn fixes a serious problem in
the virtlockd daemon whereby it loses all fcntl() locks at re-exec due
to multiple threads existing. fcntl() locks only get preserved if the
process is single threaded at time of exec().

Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/locking/lock_daemon.c
src/logging/log_daemon.c

index 79ab90fc911029299d71128f599ce375e4b2012a..7afff42246ebbc91d13438473461c10694c6a41e 100644 (file)
@@ -165,7 +165,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged)
         goto error;
 
     if (!(srv = virNetServerNew("virtlockd", 1,
-                                1, 1, 0, config->max_clients,
+                                0, 0, 0, config->max_clients,
                                 config->max_clients, -1, 0,
                                 NULL,
                                 virLockDaemonClientNew,
@@ -180,7 +180,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged)
     srv = NULL;
 
     if (!(srv = virNetServerNew("admin", 1,
-                                1, 1, 0, config->admin_max_clients,
+                                0, 0, 0, config->admin_max_clients,
                                 config->admin_max_clients, -1, 0,
                                 NULL,
                                 remoteAdmClientNew,
index d54d26ab9d13509f0dae286d6a4ba3608b1b989b..35d7ebb6d2bb120d68353c9aaeeb367b827fc934 100644 (file)
@@ -154,7 +154,7 @@ virLogDaemonNew(virLogDaemonConfigPtr config, bool privileged)
         goto error;
 
     if (!(srv = virNetServerNew("virtlogd", 1,
-                                1, 1, 0, config->max_clients,
+                                0, 0, 0, config->max_clients,
                                 config->max_clients, -1, 0,
                                 NULL,
                                 virLogDaemonClientNew,
@@ -169,7 +169,7 @@ virLogDaemonNew(virLogDaemonConfigPtr config, bool privileged)
     srv = NULL;
 
     if (!(srv = virNetServerNew("admin", 1,
-                                1, 1, 0, config->admin_max_clients,
+                                0, 0, 0, config->admin_max_clients,
                                 config->admin_max_clients, -1, 0,
                                 NULL,
                                 remoteAdmClientNew,