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>
This commit is contained in:
parent
84da099ed3
commit
b61103d7ea
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user