summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd.c13
-rw-r--r--cli/src/cli-cmd.h2
-rw-r--r--cli/src/cli.h1
3 files changed, 11 insertions, 5 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c
index 385e2ac2e..17869eb61 100644
--- a/cli/src/cli-cmd.c
+++ b/cli/src/cli-cmd.c
@@ -31,6 +31,7 @@
#include "cli.h"
#include "cli-cmd.h"
#include "cli-mem-types.h"
+#include "protocol-common.h"
#include <fnmatch.h>
@@ -281,14 +282,14 @@ seconds_from_now (unsigned secs, struct timespec *ts)
}
int
-cli_cmd_await_response ()
+cli_cmd_await_response (unsigned time)
{
struct timespec ts = {0,};
int ret = 0;
cli_op_ret = -1;
- seconds_from_now (CLI_DEFAULT_CMD_TIMEOUT, &ts);
+ seconds_from_now (time, &ts);
while (!cmd_done && !ret) {
ret = pthread_cond_timedwait (&cond, &cond_mutex,
&ts);
@@ -366,7 +367,11 @@ cli_cmd_submit (void *req, call_frame_t *frame,
int procnum, struct iobref *iobref,
xlator_t *this, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc)
{
- int ret = -1;
+ int ret = -1;
+ unsigned timeout = 0;
+
+ timeout = (GLUSTER_CLI_PROFILE_VOLUME == procnum) ?
+ CLI_TOP_CMD_TIMEOUT : CLI_DEFAULT_CMD_TIMEOUT;
cli_cmd_lock ();
cmd_sent = 0;
@@ -375,7 +380,7 @@ cli_cmd_submit (void *req, call_frame_t *frame,
if (!ret) {
cmd_sent = 1;
- ret = cli_cmd_await_response ();
+ ret = cli_cmd_await_response (timeout);
} else
cli_cmd_unlock ();
diff --git a/cli/src/cli-cmd.h b/cli/src/cli-cmd.h
index 1878571fa..82e0ff113 100644
--- a/cli/src/cli-cmd.h
+++ b/cli/src/cli-cmd.h
@@ -83,7 +83,7 @@ struct cli_cmd_word *cli_cmd_nextword (struct cli_cmd_word *word,
const char *text);
void cli_cmd_tokens_destroy (char **tokens);
-int cli_cmd_await_response ();
+int cli_cmd_await_response (unsigned time);
int cli_cmd_broadcast_response (int32_t status);
diff --git a/cli/src/cli.h b/cli/src/cli.h
index 1e0d69cd8..bf3437827 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -33,6 +33,7 @@
#define CLI_GLUSTERD_PORT 24007
#define CLI_DEFAULT_CONN_TIMEOUT 120
#define CLI_DEFAULT_CMD_TIMEOUT 120
+#define CLI_TOP_CMD_TIMEOUT 300 //Longer timeout for volume top
#define DEFAULT_CLI_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs"
#define CLI_VOL_STATUS_BRICK_LEN 55
#define CLI_TAB_LENGTH 8