summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2010-08-17 06:06:30 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-17 11:18:15 -0700
commitc0dfd786795a8704e92b8e35120780b8c8907f32 (patch)
tree921a9b1affe923859b8310456d36087083f11685 /cli
parent08699df02322c5f8ec926edf367da4cb96b90ad3 (diff)
cli: block command hang
Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1370 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1370
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c
index d7a4fcd8..7dc41680 100644
--- a/cli/src/cli-cmd.c
+++ b/cli/src/cli-cmd.c
@@ -239,7 +239,7 @@ cli_cmd_await_response ()
int ret = 0;
cli_op_ret = -1;
- cmd_done = 0;
+
time (&ts.tv_sec);
ts.tv_sec += CLI_DEFAULT_CMD_TIMEOUT;
while (!cmd_done && !ret) {
@@ -247,6 +247,8 @@ cli_cmd_await_response ()
&ts);
}
+ cmd_done = 0;
+
cli_cmd_unlock ();
if (ret)
@@ -258,19 +260,19 @@ cli_cmd_await_response ()
int
cli_cmd_broadcast_response (int32_t status)
{
- if (!cmd_sent)
- goto out;
pthread_mutex_lock (&cond_mutex);
{
+ if (!cmd_sent)
+ goto out;
cmd_done = 1;
cli_op_ret = status;
pthread_cond_broadcast (&cond);
}
- pthread_mutex_unlock (&cond_mutex);
out:
+ pthread_mutex_unlock (&cond_mutex);
return 0;
}