|
|
256ebe |
From 023854d5573211d4737eb0ebe7ec954a7b7bb4ee Mon Sep 17 00:00:00 2001
|
|
|
256ebe |
From: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
256ebe |
Date: Mon, 15 Apr 2019 10:34:34 +0530
|
|
|
256ebe |
Subject: [PATCH 105/124] core: Log level changes do not effect on running
|
|
|
256ebe |
client process
|
|
|
256ebe |
|
|
|
256ebe |
Problem: commit c34e4161f3cb6539ec83a9020f3d27eb4759a975 set log-level
|
|
|
256ebe |
per xlator during reconfigure only for a brick process not for
|
|
|
256ebe |
the client process.
|
|
|
256ebe |
|
|
|
256ebe |
Solution: 1) Change per xlator log-level only if brick_mux is enabled.To make sure
|
|
|
256ebe |
about brick multiplex introudce a flag brick_mux at ctx->cmd_args.
|
|
|
256ebe |
|
|
|
256ebe |
Note: There are two other changes done with this patch
|
|
|
256ebe |
1) Ignore client-log-level option to attach a brick with
|
|
|
256ebe |
already running brick if brick_mux is enabled
|
|
|
256ebe |
2) Add a log to print pid of the running process to make easier
|
|
|
256ebe |
debugging
|
|
|
256ebe |
|
|
|
256ebe |
> Change-Id: I39e85de778e150d0685cd9a79425ce8b4783f9c9
|
|
|
256ebe |
> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
256ebe |
> Fixes: bz#1696046
|
|
|
256ebe |
> (Cherry picked from commit 798aadbe51a9a02dd98a0f861cc239ecf7c8ed57)
|
|
|
256ebe |
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/22495/)
|
|
|
256ebe |
|
|
|
256ebe |
Change-Id: If82cc8e51cf00bd50d3321d31ec420f89786ea02
|
|
|
256ebe |
Fixes: bz#1695081
|
|
|
256ebe |
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
256ebe |
Reviewed-on: https://code.engineering.redhat.com/gerrit/167828
|
|
|
256ebe |
Tested-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
256ebe |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
256ebe |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
256ebe |
---
|
|
|
256ebe |
glusterfsd/src/glusterfsd-messages.h | 2 +-
|
|
|
256ebe |
glusterfsd/src/glusterfsd.c | 20 ++++-
|
|
|
256ebe |
glusterfsd/src/glusterfsd.h | 1 +
|
|
|
256ebe |
libglusterfs/src/glusterfs/glusterfs.h | 1 +
|
|
|
256ebe |
tests/bugs/glusterd/bug-1696046.t | 113 +++++++++++++++++++++++++++++
|
|
|
256ebe |
xlators/debug/io-stats/src/io-stats.c | 22 +++---
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-utils.c | 7 ++
|
|
|
256ebe |
7 files changed, 152 insertions(+), 14 deletions(-)
|
|
|
256ebe |
create mode 100644 tests/bugs/glusterd/bug-1696046.t
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/glusterfsd/src/glusterfsd-messages.h b/glusterfsd/src/glusterfsd-messages.h
|
|
|
256ebe |
index 94312a5..280624c 100644
|
|
|
256ebe |
--- a/glusterfsd/src/glusterfsd-messages.h
|
|
|
256ebe |
+++ b/glusterfsd/src/glusterfsd-messages.h
|
|
|
256ebe |
@@ -36,6 +36,6 @@ GLFS_MSGID(GLUSTERFSD, glusterfsd_msg_1, glusterfsd_msg_2, glusterfsd_msg_3,
|
|
|
256ebe |
glusterfsd_msg_31, glusterfsd_msg_32, glusterfsd_msg_33,
|
|
|
256ebe |
glusterfsd_msg_34, glusterfsd_msg_35, glusterfsd_msg_36,
|
|
|
256ebe |
glusterfsd_msg_37, glusterfsd_msg_38, glusterfsd_msg_39,
|
|
|
256ebe |
- glusterfsd_msg_40, glusterfsd_msg_41, glusterfsd_msg_42);
|
|
|
256ebe |
+ glusterfsd_msg_40, glusterfsd_msg_41, glusterfsd_msg_42, glusterfsd_msg_43);
|
|
|
256ebe |
|
|
|
256ebe |
#endif /* !_GLUSTERFSD_MESSAGES_H_ */
|
|
|
256ebe |
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
|
|
|
256ebe |
index 3aa89ca..6aee4c1 100644
|
|
|
256ebe |
--- a/glusterfsd/src/glusterfsd.c
|
|
|
256ebe |
+++ b/glusterfsd/src/glusterfsd.c
|
|
|
256ebe |
@@ -85,8 +85,7 @@ static char gf_doc[] = "";
|
|
|
256ebe |
static char argp_doc[] =
|
|
|
256ebe |
"--volfile-server=SERVER [MOUNT-POINT]\n"
|
|
|
256ebe |
"--volfile=VOLFILE [MOUNT-POINT]";
|
|
|
256ebe |
-const char *argp_program_version =
|
|
|
256ebe |
- PACKAGE_NAME" "PACKAGE_VERSION;
|
|
|
256ebe |
+const char *argp_program_version = PACKAGE_NAME " " PACKAGE_VERSION;
|
|
|
256ebe |
const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
|
|
|
256ebe |
|
|
|
256ebe |
static error_t
|
|
|
256ebe |
@@ -266,6 +265,7 @@ static struct argp_option gf_options[] = {
|
|
|
256ebe |
"attribute, dentry and page-cache. "
|
|
|
256ebe |
"Disable this only if same files/directories are not accessed across "
|
|
|
256ebe |
"two different mounts concurrently [default: \"on\"]"},
|
|
|
256ebe |
+ {"brick-mux", ARGP_BRICK_MUX_KEY, 0, 0, "Enable brick mux. "},
|
|
|
256ebe |
{0, 0, 0, 0, "Miscellaneous Options:"},
|
|
|
256ebe |
{
|
|
|
256ebe |
0,
|
|
|
256ebe |
@@ -702,7 +702,6 @@ create_fuse_mount(glusterfs_ctx_t *ctx)
|
|
|
256ebe |
xlator_t *master = NULL;
|
|
|
256ebe |
|
|
|
256ebe |
cmd_args = &ctx->cmd_args;
|
|
|
256ebe |
-
|
|
|
256ebe |
if (!cmd_args->mount_point) {
|
|
|
256ebe |
gf_msg_trace("glusterfsd", 0,
|
|
|
256ebe |
"mount point not found, not a client process");
|
|
|
256ebe |
@@ -1090,6 +1089,10 @@ parse_opts(int key, char *arg, struct argp_state *state)
|
|
|
256ebe |
cmd_args->thin_client = _gf_true;
|
|
|
256ebe |
break;
|
|
|
256ebe |
|
|
|
256ebe |
+ case ARGP_BRICK_MUX_KEY:
|
|
|
256ebe |
+ cmd_args->brick_mux = _gf_true;
|
|
|
256ebe |
+ break;
|
|
|
256ebe |
+
|
|
|
256ebe |
case ARGP_PID_FILE_KEY:
|
|
|
256ebe |
cmd_args->pid_file = gf_strdup(arg);
|
|
|
256ebe |
break;
|
|
|
256ebe |
@@ -1207,7 +1210,6 @@ parse_opts(int key, char *arg, struct argp_state *state)
|
|
|
256ebe |
case ARGP_KEY_ARG:
|
|
|
256ebe |
if (state->arg_num >= 1)
|
|
|
256ebe |
argp_usage(state);
|
|
|
256ebe |
-
|
|
|
256ebe |
cmd_args->mount_point = gf_strdup(arg);
|
|
|
256ebe |
break;
|
|
|
256ebe |
|
|
|
256ebe |
@@ -2540,6 +2542,8 @@ postfork:
|
|
|
256ebe |
if (ret)
|
|
|
256ebe |
goto out;
|
|
|
256ebe |
}
|
|
|
256ebe |
+ gf_log("glusterfs", GF_LOG_INFO, "Pid of current running process is %d",
|
|
|
256ebe |
+ getpid());
|
|
|
256ebe |
ret = gf_log_inject_timer_event(ctx);
|
|
|
256ebe |
|
|
|
256ebe |
glusterfs_signals_setup(ctx);
|
|
|
256ebe |
@@ -2787,6 +2791,14 @@ main(int argc, char *argv[])
|
|
|
256ebe |
if (ret)
|
|
|
256ebe |
goto out;
|
|
|
256ebe |
|
|
|
256ebe |
+ /* set brick_mux mode only for server process */
|
|
|
256ebe |
+ if ((ctx->process_mode != GF_SERVER_PROCESS) && cmd->brick_mux) {
|
|
|
256ebe |
+ gf_msg("glusterfs", GF_LOG_CRITICAL, 0, glusterfsd_msg_43,
|
|
|
256ebe |
+ "command line argument --brick-mux is valid only for brick "
|
|
|
256ebe |
+ "process");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
/* log the version of glusterfs running here along with the actual
|
|
|
256ebe |
command line options. */
|
|
|
256ebe |
{
|
|
|
256ebe |
diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h
|
|
|
256ebe |
index 35cf6d8..fa55789 100644
|
|
|
256ebe |
--- a/glusterfsd/src/glusterfsd.h
|
|
|
256ebe |
+++ b/glusterfsd/src/glusterfsd.h
|
|
|
256ebe |
@@ -111,6 +111,7 @@ enum argp_option_keys {
|
|
|
256ebe |
ARGP_FUSE_FLUSH_HANDLE_INTERRUPT_KEY = 189,
|
|
|
256ebe |
ARGP_FUSE_LRU_LIMIT_KEY = 190,
|
|
|
256ebe |
ARGP_FUSE_AUTO_INVAL_KEY = 191,
|
|
|
256ebe |
+ ARGP_BRICK_MUX_KEY = 192
|
|
|
256ebe |
};
|
|
|
256ebe |
|
|
|
256ebe |
struct _gfd_vol_top_priv {
|
|
|
256ebe |
diff --git a/libglusterfs/src/glusterfs/glusterfs.h b/libglusterfs/src/glusterfs/glusterfs.h
|
|
|
256ebe |
index deec5ba..fb727fc 100644
|
|
|
256ebe |
--- a/libglusterfs/src/glusterfs/glusterfs.h
|
|
|
256ebe |
+++ b/libglusterfs/src/glusterfs/glusterfs.h
|
|
|
256ebe |
@@ -575,6 +575,7 @@ struct _cmd_args {
|
|
|
256ebe |
|
|
|
256ebe |
int fuse_flush_handle_interrupt;
|
|
|
256ebe |
int fuse_auto_inval;
|
|
|
256ebe |
+ bool brick_mux;
|
|
|
256ebe |
};
|
|
|
256ebe |
typedef struct _cmd_args cmd_args_t;
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/tests/bugs/glusterd/bug-1696046.t b/tests/bugs/glusterd/bug-1696046.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..e1c1eb2
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/bugs/glusterd/bug-1696046.t
|
|
|
256ebe |
@@ -0,0 +1,113 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+function count_up_bricks {
|
|
|
256ebe |
+ $CLI --xml volume status $1 | grep '<status>1' | wc -l
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function count_brick_processes {
|
|
|
256ebe |
+ pgrep glusterfsd | wc -l
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+logdir=`gluster --print-logdir`
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Start and create a volume
|
|
|
256ebe |
+TEST glusterd;
|
|
|
256ebe |
+TEST pidof glusterd;
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume set all cluster.brick-multiplex on
|
|
|
256ebe |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{1,2,3};
|
|
|
256ebe |
+TEST $CLI volume create $V1 replica 3 $H0:$B0/${V1}{1,2,3};
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Start volume and verify
|
|
|
256ebe |
+TEST $CLI volume start $V0;
|
|
|
256ebe |
+EXPECT 'Started' volinfo_field $V0 'Status';
|
|
|
256ebe |
+TEST $CLI volume start $V1;
|
|
|
256ebe |
+EXPECT 'Started' volinfo_field $V1 'Status';
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 4 count_up_bricks $V0
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 4 count_up_bricks $V1
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT 1 count_brick_processes
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Mount V0
|
|
|
256ebe |
+TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 --entry-timeout=0 $M0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+function client-log-file-name()
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ logfilename=$M0".log"
|
|
|
256ebe |
+ echo ${logfilename:1} | tr / -
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function brick-log-file-name()
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ logfilename=$B0"/"$V0"1.log"
|
|
|
256ebe |
+ echo ${logfilename:1} | tr / -
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+log_file=$logdir"/"`client-log-file-name`
|
|
|
256ebe |
+nofdlog=$(cat $log_file | grep " D " | wc -l)
|
|
|
256ebe |
+TEST [ $((nofdlog)) -eq 0 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+brick_log_file=$logdir"/bricks/"`brick-log-file-name`
|
|
|
256ebe |
+nofdlog=$(cat $brick_log_file | grep " D " | wc -l)
|
|
|
256ebe |
+TEST [ $((nofdlog)) -eq 0 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Set brick-log-level to DEBUG
|
|
|
256ebe |
+TEST $CLI volume set $V0 diagnostics.brick-log-level DEBUG
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Do some operation
|
|
|
256ebe |
+touch $M0/file1
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Check debug message debug message should be exist only for V0
|
|
|
256ebe |
+# Server xlator is common in brick_mux so after enabling DEBUG log
|
|
|
256ebe |
+# some debug message should be available for other xlators like posix
|
|
|
256ebe |
+
|
|
|
256ebe |
+brick_log_file=$logdir"/bricks/"`brick-log-file-name`
|
|
|
256ebe |
+nofdlog=$(cat $brick_log_file | grep file1 | grep -v server | wc -l)
|
|
|
256ebe |
+TEST [ $((nofdlog)) -ne 0 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Check if any debug log exist in client-log file
|
|
|
256ebe |
+nofdlog=$(cat $log_file | grep " D " | wc -l)
|
|
|
256ebe |
+TEST [ $((nofdlog)) -eq 0 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Set brick-log-level to INFO
|
|
|
256ebe |
+TEST $CLI volume set $V0 diagnostics.brick-log-level INFO
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Set client-log-level to DEBUG
|
|
|
256ebe |
+TEST $CLI volume set $V0 diagnostics.client-log-level DEBUG
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Do some operation
|
|
|
256ebe |
+touch $M0/file2
|
|
|
256ebe |
+
|
|
|
256ebe |
+nofdlog=$(cat $brick_log_file | grep " D " | grep file2 | wc -l)
|
|
|
256ebe |
+TEST [ $((nofdlog)) -eq 0 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+nofdlog=$(cat $log_file | grep " D " | wc -l)
|
|
|
256ebe |
+TEST [ $((nofdlog)) -ne 0 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Unmount V0
|
|
|
256ebe |
+TEST umount $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Mount V1
|
|
|
256ebe |
+TEST glusterfs --volfile-id=$V1 --volfile-server=$H0 --entry-timeout=0 $M0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#do some operation
|
|
|
256ebe |
+touch $M0/file3
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# DEBUG log level is enabled only for V0 so no debug message should be available
|
|
|
256ebe |
+# in log specific to file2 creation except for server xlator, server xlator is
|
|
|
256ebe |
+# common xlator in brick mulitplex
|
|
|
256ebe |
+nofdlog=$(cat $brick_log_file | grep file3 | grep -v server | wc -l)
|
|
|
256ebe |
+TEST [ $((nofdlog)) -eq 0 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Unmount V1
|
|
|
256ebe |
+TEST umount $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
|
|
|
256ebe |
index 41b57c5..aa91a0a 100644
|
|
|
256ebe |
--- a/xlators/debug/io-stats/src/io-stats.c
|
|
|
256ebe |
+++ b/xlators/debug/io-stats/src/io-stats.c
|
|
|
256ebe |
@@ -3704,19 +3704,23 @@ xlator_set_loglevel(xlator_t *this, int log_level)
|
|
|
256ebe |
active = ctx->active;
|
|
|
256ebe |
top = active->first;
|
|
|
256ebe |
|
|
|
256ebe |
- if (strcmp(top->type, "protocol/server") || (log_level == -1))
|
|
|
256ebe |
+ if (log_level == -1)
|
|
|
256ebe |
return;
|
|
|
256ebe |
|
|
|
256ebe |
- /* Set log-level for server xlator */
|
|
|
256ebe |
- top->loglevel = log_level;
|
|
|
256ebe |
+ if (ctx->cmd_args.brick_mux) {
|
|
|
256ebe |
+ /* Set log-level for all brick xlators */
|
|
|
256ebe |
+ top->loglevel = log_level;
|
|
|
256ebe |
|
|
|
256ebe |
- /* Set log-level for parent xlator */
|
|
|
256ebe |
- if (this->parents)
|
|
|
256ebe |
- this->parents->xlator->loglevel = log_level;
|
|
|
256ebe |
+ /* Set log-level for parent xlator */
|
|
|
256ebe |
+ if (this->parents)
|
|
|
256ebe |
+ this->parents->xlator->loglevel = log_level;
|
|
|
256ebe |
|
|
|
256ebe |
- while (trav) {
|
|
|
256ebe |
- trav->loglevel = log_level;
|
|
|
256ebe |
- trav = trav->next;
|
|
|
256ebe |
+ while (trav) {
|
|
|
256ebe |
+ trav->loglevel = log_level;
|
|
|
256ebe |
+ trav = trav->next;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ gf_log_set_loglevel(this->ctx, log_level);
|
|
|
256ebe |
}
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
256ebe |
index 2dd5f91..fdd7d91 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
256ebe |
@@ -2240,6 +2240,9 @@ retry:
|
|
|
256ebe |
if (volinfo->memory_accounting)
|
|
|
256ebe |
runner_add_arg(&runner, "--mem-accounting");
|
|
|
256ebe |
|
|
|
256ebe |
+ if (is_brick_mx_enabled())
|
|
|
256ebe |
+ runner_add_arg(&runner, "--brick-mux");
|
|
|
256ebe |
+
|
|
|
256ebe |
runner_log(&runner, "", 0, "Starting GlusterFS");
|
|
|
256ebe |
|
|
|
256ebe |
brickinfo->port = port;
|
|
|
256ebe |
@@ -2378,6 +2381,10 @@ unsafe_option(dict_t *this, char *key, data_t *value, void *arg)
|
|
|
256ebe |
return _gf_false;
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+ if (fnmatch("*diagnostics.client-log*", key, 0) == 0) {
|
|
|
256ebe |
+ return _gf_false;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
return _gf_true;
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
--
|
|
|
256ebe |
1.8.3.1
|
|
|
256ebe |
|