summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav Yadav <gyadav@redhat.com>2017-05-21 12:31:29 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-05-25 15:31:53 +0000
commita80ec1b99309ca113cd673d2bc0cf20d50822a47 (patch)
tree2b9c8aa252b9ff5ab3496b4c60d96bd6e6f5e9dd
parentb8b398a5ee7a0e02582b2c441548bd758ebdb71c (diff)
glusterd : volume profile command on one of the node crashes glusterd
When volume profile command is issued on one of the node glusterd crashes. Its a race condition which may hit when profile command and status command is being executed from node A and node B respectively. While doing so event GD_OP_STATE_BRICK_OP_SENT/GD_OP_STATE_BRICK_COMMITTED is being triggered. As handling of event is not thread safe, hence context got modify and glusterd crashes. With the fix now we are validating the context before using it. > Reviewed-on: https://review.gluster.org/17350 > Smoke: Gluster Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Samikshan Bairagya <samikshan@gmail.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> (cherry picked from commit 8dc63c8824fc1a00c873c16e8a16a14fca7c8cca) Change-Id: Ic07c3cdc5644677b0e40ff0fac6fcca834158913 BUG: 1454612 Signed-off-by: Gaurav Yadav <gyadav@redhat.com> Reviewed-on: https://review.gluster.org/17362 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 1a12b0e7160..9b68967f445 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -7606,7 +7606,7 @@ out:
static int
glusterd_op_ac_rcvd_brick_op_acc (glusterd_op_sm_event_t *event, void *ctx)
{
- int ret = 0;
+ int ret = -1;
glusterd_op_brick_rsp_ctx_t *ev_ctx = NULL;
char *op_errstr = NULL;
glusterd_op_t op = GD_OP_NONE;
@@ -7617,13 +7617,14 @@ glusterd_op_ac_rcvd_brick_op_acc (glusterd_op_sm_event_t *event, void *ctx)
xlator_t *this = NULL;
this = THIS;
- GF_ASSERT (this);
- GF_ASSERT (event);
- GF_ASSERT (ctx);
+ GF_VALIDATE_OR_GOTO ("glusterd", this, out);
+ GF_VALIDATE_OR_GOTO (this->name, event, out);
+ GF_VALIDATE_OR_GOTO (this->name, ctx, out);
ev_ctx = ctx;
+ GF_VALIDATE_OR_GOTO(this->name, ev_ctx, out);
req_ctx = ev_ctx->commit_ctx;
- GF_ASSERT (req_ctx);
+ GF_VALIDATE_OR_GOTO (this->name, req_ctx, out);
op = req_ctx->op;
op_ctx = glusterd_op_get_ctx ();