summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli-cmd-parser.c3
-rw-r--r--libglusterfs/src/statedump.c35
2 files changed, 19 insertions, 19 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 0f13928..d41493b 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -2027,7 +2027,8 @@ gf_boolean_t
cli_cmd_validate_dumpoption (const char *arg, char **option)
{
char *opwords[] = {"all", "nfs", "mem", "iobuf", "callpool", "priv",
- "fd", "inode", "history", NULL};
+ "fd", "inode", "history", "inodectx", "fdctx",
+ NULL};
char *w = NULL;
w = str_getunamb (arg, opwords);
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index f438c5a..b74a161 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -524,26 +524,26 @@ gf_proc_dump_parse_set_option (char *key, char *value)
char buf[GF_DUMP_MAX_BUF_LEN];
int ret = -1;
- if (!strncasecmp (key, "all", 3)) {
+ if (!strcasecmp (key, "all")) {
(void)gf_proc_dump_enable_all_options ();
return 0;
- } else if (!strncasecmp (key, "mem", 3)) {
+ } else if (!strcasecmp (key, "mem")) {
opt_key = &dump_options.dump_mem;
- } else if (!strncasecmp (key, "iobuf", 5)) {
+ } else if (!strcasecmp (key, "iobuf")) {
opt_key = &dump_options.dump_iobuf;
- } else if (!strncasecmp (key, "callpool", 8)) {
+ } else if (!strcasecmp (key, "callpool")) {
opt_key = &dump_options.dump_callpool;
- } else if (!strncasecmp (key, "priv", 4)) {
+ } else if (!strcasecmp (key, "priv")) {
opt_key = &dump_options.xl_options.dump_priv;
- } else if (!strncasecmp (key, "fd", 2)) {
+ } else if (!strcasecmp (key, "fd")) {
opt_key = &dump_options.xl_options.dump_fd;
- } else if (!strncasecmp (key, "inode", 5)) {
+ } else if (!strcasecmp (key, "inode")) {
opt_key = &dump_options.xl_options.dump_inode;
- } else if (!strncasecmp (key, "inodectx", strlen ("inodectx"))) {
+ } else if (!strcasecmp (key, "inodectx")) {
opt_key = &dump_options.xl_options.dump_inodectx;
- } else if (!strncasecmp (key, "fdctx", strlen ("fdctx"))) {
+ } else if (!strcasecmp (key, "fdctx")) {
opt_key = &dump_options.xl_options.dump_fdctx;
- } else if (!strncasecmp (key, "history", strlen ("history"))) {
+ } else if (!strcasecmp (key, "history")) {
opt_key = &dump_options.xl_options.dump_history;
}
@@ -553,11 +553,9 @@ gf_proc_dump_parse_set_option (char *key, char *value)
"matched key : %s\n", key);
ret = write (gf_dump_fd, buf, strlen (buf));
- /* warning suppression */
- if (ret >= 0) {
+ if (ret >= 0)
ret = -1;
- goto out;
- }
+ goto out;
}
@@ -572,7 +570,7 @@ out:
}
static int
-gf_proc_dump_options_init (char *dump_name)
+gf_proc_dump_options_init ()
{
int ret = -1;
FILE *fp = NULL;
@@ -642,11 +640,11 @@ gf_proc_dump_info (int signum)
} else
strncpy (brick_name, "glusterdump", sizeof (brick_name));
- ret = gf_proc_dump_options_init (brick_name);
+ ret = gf_proc_dump_open (ctx->statedump_path, brick_name);
if (ret < 0)
goto out;
- ret = gf_proc_dump_open (ctx->statedump_path, brick_name);
+ ret = gf_proc_dump_options_init ();
if (ret < 0)
goto out;
@@ -681,8 +679,9 @@ gf_proc_dump_info (int signum)
i++;
}
- gf_proc_dump_close ();
out:
+ if (gf_dump_fd != -1)
+ gf_proc_dump_close ();
gf_proc_dump_unlock ();
return;