commands: don't lock the whole command

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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 0ec9b0cc
......@@ -869,9 +869,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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment