mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
clvmd: improve mutex usage in request_timed_out
Use mutex to access localsock values, so check num_replies when the thread is not yet finished. Check for threadid prior the mutex taking (though this check is probably not really needed)
This commit is contained in:
parent
7075656034
commit
7236b92857
@ -1,5 +1,6 @@
|
||||
Version 2.02.107 -
|
||||
==================================
|
||||
Use mutex to check number of replies in request_timed_out() in clvmd.
|
||||
Drop usage of extra reply_mutex for localsock in clvmd.
|
||||
Protect manipulation with finished flag with mutex in clvmd.
|
||||
Shift mutex creation and destroy for localsock in clvmd to correct place.
|
||||
|
@ -812,17 +812,21 @@ static void request_timed_out(struct local_client *client)
|
||||
DEBUGLOG("Request timed-out. padding\n");
|
||||
clops->cluster_do_node_callback(client, timedout_callback);
|
||||
|
||||
if (client->bits.localsock.num_replies !=
|
||||
client->bits.localsock.expected_replies) {
|
||||
/* Post-process the command */
|
||||
if (client->bits.localsock.threadid) {
|
||||
if (!client->bits.localsock.threadid)
|
||||
return;
|
||||
|
||||
pthread_mutex_lock(&client->bits.localsock.mutex);
|
||||
|
||||
if (!client->bits.localsock.finished &&
|
||||
(client->bits.localsock.num_replies !=
|
||||
client->bits.localsock.expected_replies)) {
|
||||
/* Post-process the command */
|
||||
client->bits.localsock.state = POST_COMMAND;
|
||||
pthread_cond_signal(&client->bits.localsock.cond);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&client->bits.localsock.mutex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This is where the real work happens */
|
||||
static void main_loop(int cmd_timeout)
|
||||
|
Loading…
Reference in New Issue
Block a user