summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2014-05-06 04:19:48 +0000
committerKaushal M <kaushal@redhat.com>2014-05-08 03:44:41 -0700
commite80daecc3dd3023f010c785ff0e238fc92214477 (patch)
treefd6f8a4f11a40cdcca4018e6013beda6a84d4bd8 /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parentb47b46d98a5e1d3e6e9eb9bde4f81b745f2ac09d (diff)
glusterd: Use a calloc-ed copy of txn_id for glusterd_do_replace_brick
As glusterd_do_replace_brick() is spawned through gf_timer_call_after(), by the time it's called the event is freed, and the txn_id is lost. Hence using a calloc-ed copy, which will be freed as a part of rb_ctx dict. Change-Id: I3e309fe1a7ba96ad1d1ce01f4d2aa18178f59244 BUG: 1095097 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/7686 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 868a58be5b6..edafb5469ae 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3565,6 +3565,7 @@ glusterd_op_start_rb_timer (dict_t *dict, uuid_t *txn_id)
glusterd_conf_t *priv = NULL;
int32_t ret = -1;
dict_t *rb_ctx = NULL;
+ uuid_t *rb_txn_id = NULL;
GF_ASSERT (dict);
priv = THIS->private;
@@ -3581,10 +3582,14 @@ glusterd_op_start_rb_timer (dict_t *dict, uuid_t *txn_id)
goto out;
}
+ rb_txn_id = GF_CALLOC (1, sizeof(uuid_t), gf_common_mt_uuid_t);
+ if (!rb_txn_id)
+ goto out;
+
+ uuid_copy (*rb_txn_id, *txn_id);
timeout.tv_sec = 5;
timeout.tv_nsec = 0;
-
rb_ctx = dict_copy (dict, rb_ctx);
if (!rb_ctx) {
gf_log (THIS->name, GF_LOG_ERROR, "Couldn't copy "
@@ -3594,14 +3599,14 @@ glusterd_op_start_rb_timer (dict_t *dict, uuid_t *txn_id)
}
ret = dict_set_bin (rb_ctx, "transaction_id",
- txn_id, sizeof (*txn_id));
+ rb_txn_id, sizeof (*rb_txn_id));
if (ret) {
gf_log ("", GF_LOG_ERROR,
"Failed to set transaction id.");
goto out;
} else
gf_log ("", GF_LOG_DEBUG,
- "transaction_id = %s", uuid_utoa (*txn_id));
+ "transaction_id = %s", uuid_utoa (*rb_txn_id));
priv->timer = gf_timer_call_after (THIS->ctx, timeout,
glusterd_do_replace_brick,