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 /libglusterfs | |
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>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/statedump.c | 35 |
1 files changed, 17 insertions, 18 deletions
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; |