diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2011-10-11 09:56:44 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2011-10-11 09:56:44 +0000 |
commit | 1ba44957bf587d54bbbca1e99282253bb6e44eb7 (patch) | |
tree | 27def0f667934150a34c337021b70830a910a55c /daemons/clvmd | |
parent | 8a706f836d76154e2f65922d29c0e4acf7da5aa2 (diff) | |
download | lvm2-1ba44957bf587d54bbbca1e99282253bb6e44eb7.tar.gz lvm2-1ba44957bf587d54bbbca1e99282253bb6e44eb7.tar.xz lvm2-1ba44957bf587d54bbbca1e99282253bb6e44eb7.zip |
Add some fixme locking
Code here is using thread write protected variable without locking.
So add locking, for proper synchronization and a FIXME, since the
code needs closer look.
Diffstat (limited to 'daemons/clvmd')
-rw-r--r-- | daemons/clvmd/clvmd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 1bb7995d..3199ac5d 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -747,12 +747,16 @@ static int local_pipe_callback(struct local_client *thisfd, char *buf, send_local_reply(sock_client, status, sock_client->fd); else { + /* FIXME: closer inspect this code since state is write thread protected */ + pthread_mutex_lock(&sock_client->bits.localsock.mutex); if (sock_client->bits.localsock.state == POST_COMMAND) { + pthread_mutex_unlock(&sock_client->bits.localsock.mutex); send_local_reply(sock_client, 0, sock_client->fd); } else // PRE_COMMAND finished. { + pthread_mutex_unlock(&sock_client->bits.localsock.mutex); if ( (status = distribute_command(sock_client)) != |