summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c59
1 files changed, 58 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 1d55cc8a215..7686fe050bc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -5946,6 +5946,31 @@ out:
static int gd_stale_rpc_disconnect_log;
+static int
+glusterd_mark_bricks_stopped_by_proc (glusterd_brick_proc_t *brick_proc) {
+ glusterd_brickinfo_t *brickinfo = NULL;
+ glusterd_brickinfo_t *brickinfo_tmp = NULL;
+ glusterd_volinfo_t *volinfo = NULL;
+ int ret = -1;
+
+ cds_list_for_each_entry (brickinfo, &brick_proc->bricks, brick_list) {
+ ret = glusterd_get_volinfo_from_brick (brickinfo->path, &volinfo);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL,
+ "Failed to get volinfo from brick(%s)",
+ brickinfo->path);
+ goto out;
+ }
+ cds_list_for_each_entry (brickinfo_tmp, &volinfo->bricks, brick_list) {
+ if (strcmp (brickinfo->path, brickinfo_tmp->path) == 0)
+ glusterd_set_brick_status (brickinfo_tmp, GF_BRICK_STOPPED);
+ }
+ }
+ return 0;
+out:
+ return ret;
+}
+
int
__glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
rpc_clnt_event_t event, void *data)
@@ -5956,6 +5981,9 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_volinfo_t *volinfo = NULL;
xlator_t *this = NULL;
+ int temp = 0;
+ glusterd_brickinfo_t *brickinfo_tmp = NULL;
+ glusterd_brick_proc_t *brick_proc = NULL;
brickid = mydata;
if (!brickid)
@@ -6056,7 +6084,36 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
brickinfo->path);
}
- glusterd_set_brick_status (brickinfo, GF_BRICK_STOPPED);
+ if (is_brick_mx_enabled()) {
+ cds_list_for_each_entry (brick_proc, &conf->brick_procs,
+ brick_proc_list) {
+ cds_list_for_each_entry (brickinfo_tmp,
+ &brick_proc->bricks,
+ brick_list) {
+ if (strcmp (brickinfo_tmp->path,
+ brickinfo->path) == 0) {
+ ret = glusterd_mark_bricks_stopped_by_proc
+ (brick_proc);
+ if (ret) {
+ gf_msg(THIS->name,
+ GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_STOP_FAIL,
+ "Unable to stop "
+ "bricks of process"
+ " to which brick(%s)"
+ " belongs",
+ brickinfo->path);
+ goto out;
+ }
+ temp = 1;
+ break;
+ }
+ }
+ if (temp == 1)
+ break;
+ }
+ } else
+ glusterd_set_brick_status (brickinfo, GF_BRICK_STOPPED);
break;
case RPC_CLNT_DESTROY: