]> git.proxmox.com Git - mirror_lxc.git/commitdiff
commands: don't lock the whole command
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 22 Nov 2017 13:29:32 +0000 (14:29 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 6 Dec 2017 15:01:22 +0000 (16:01 +0100)
There are multiple reasons why this is not required:
- every command is transactional
- we only care about the list being modified not the memory allocation and
  other costly operations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c
src/lxc/commands_utils.c

index a896a47c2dd345cf4a55ed292f631984cc5756e4..8998dc373f20bfb628c60961b1a4017a47cedbe1 100644 (file)
@@ -932,9 +932,7 @@ int lxc_cmd_add_state_client(const char *name, const char *lxcpath,
                return state;
        }
 
-       process_lock();
        ret = lxc_cmd(name, &cmd, &stopped, lxcpath, NULL);
-       process_unlock();
        if (ret < 0) {
                ERROR("%s - Failed to execute command", strerror(errno));
                return -1;
index 30c224519365584249688bbed029c8e09f394aa1..e03022f2821ab467ac966b58b0348cc1c7b253e7 100644 (file)
@@ -33,6 +33,7 @@
 #include "commands_utils.h"
 #include "initutils.h"
 #include "log.h"
+#include "lxclock.h"
 #include "monitor.h"
 #include "state.h"
 #include "utils.h"
@@ -209,8 +210,10 @@ int lxc_add_state_client(int state_client_fd, struct lxc_handler *handler,
                return -ENOMEM;
        }
 
+       process_lock();
        lxc_list_add_elem(tmplist, newclient);
        lxc_list_add_tail(&handler->state_clients, tmplist);
+       process_unlock();
 
        TRACE("added state client %d to state client list", state_client_fd);