diff options
author | Kaushal M <kaushal@redhat.com> | 2012-03-09 09:38:36 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-03-14 02:57:49 -0700 |
commit | b61103d7ea35a2ea190465c836fe0d22f9f6f8c1 (patch) | |
tree | 3922357cd6a1597ae6116f04276617b16deeda9d | |
parent | 84da099ed321621928f11fe9cd164a4b0cfe1883 (diff) |
core, cli : Changes to statedump
This patch,
* Enables missing inodectx, fdctx dumpops for cli statedump command.
* Reintroduce changes introduced in statedump.c by 489a7a10 which were
overwritten by db20a0f8.
* Change strncasecmp() in gf_proc_dump_parse_set_option() to strcasecmp()
to properly parse similar options like fd-fdctx, inode-inodectx
Change-Id: I85ad854dce73048617b933d29cf360af9d0ed90a
BUG: 797788
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/2914
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
-rw-r--r-- | cli/src/cli-cmd-parser.c | 3 | ||||
-rw-r--r-- | libglusterfs/src/statedump.c | 35 |
2 files changed, 19 insertions, 19 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 0f13928bbfc..d41493b6cf7 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 f438c5a61ea..b74a1613f6d 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; |