summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2014-02-13 04:09:34 +0000
committerRajesh Joseph <rjoseph@redhat.com>2014-03-03 22:23:10 -0800
commit60d4f64cea4752f76b9495bdea255b51d09820ff (patch)
treed54b01ff916b7fd7797ddbf0f596931651a81c9b
parent3fbc6c02d05b55ed2d500726013c241ecfb3dd2d (diff)
glusterd/Volume Lock: Corrupted Txn Id Fix
Change-Id: Ic988ffeb26a49b4c6ac0d4a8ca33124f2192744c BUG: 1064768 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/6997 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
-rwxr-xr-xtests/bugs/bug-1064768.t20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c28
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c2
5 files changed, 53 insertions, 5 deletions
diff --git a/tests/bugs/bug-1064768.t b/tests/bugs/bug-1064768.t
new file mode 100755
index 0000000..b871681
--- /dev/null
+++ b/tests/bugs/bug-1064768.t
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 2 $H0:$B0/brick0 $H0:$B0/brick1
+TEST $CLI volume start $V0
+EXPECT_WITHIN 15 'Started' volinfo_field $V0 'Status';
+
+TEST $CLI volume profile $V0 start
+TEST $CLI volume profile $V0 info
+TEST $CLI volume profile $V0 stop
+
+TEST $CLI volume status
+TEST $CLI volume stop $V0
+EXPECT_WITHIN 15 'Stopped' volinfo_field $V0 'Status';
+cleanup;
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 05e9596..e7024bd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -613,7 +613,7 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
uuid_generate (*txn_id);
ret = dict_set_bin (dict, "transaction_id",
- txn_id, sizeof (uuid_t));
+ txn_id, sizeof(*txn_id));
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to set transaction id.");
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 88c8858..c0c7244 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3353,7 +3353,7 @@ glusterd_op_start_rb_timer (dict_t *dict, uuid_t *txn_id)
}
ret = dict_set_bin (rb_ctx, "transaction_id",
- txn_id, sizeof (uuid_t));
+ txn_id, sizeof(*txn_id));
if (ret) {
gf_log ("", GF_LOG_ERROR,
"Failed to set transaction id.");
@@ -4194,7 +4194,7 @@ glusterd_op_ac_stage_op (glusterd_op_sm_event_t *event, void *ctx)
gf_log (this->name, GF_LOG_ERROR, "Out of Memory");
ret = dict_set_bin (rsp_dict, "transaction_id",
- txn_id, sizeof(uuid_t *));
+ txn_id, sizeof(*txn_id));
if (ret)
gf_log (this->name, GF_LOG_ERROR,
"Failed to set transaction id.");
@@ -4301,7 +4301,7 @@ glusterd_op_ac_commit_op (glusterd_op_sm_event_t *event, void *ctx)
gf_log (this->name, GF_LOG_ERROR, "Out of Memory");
ret = dict_set_bin (rsp_dict, "transaction_id",
- txn_id, sizeof(uuid_t));
+ txn_id, sizeof(*txn_id));
if (ret)
gf_log (this->name, GF_LOG_ERROR,
"Failed to set transaction id.");
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 821da33..4925b9a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -1404,6 +1404,7 @@ glusterd_vol_lock (call_frame_t *frame, xlator_t *this,
glusterd_conf_t *priv = NULL;
call_frame_t *dummy_frame = NULL;
dict_t *dict = NULL;
+ uuid_t *txn_id = NULL;
if (!this)
goto out;
@@ -1430,6 +1431,19 @@ glusterd_vol_lock (call_frame_t *frame, xlator_t *this,
goto out;
}
+ /* Sending valid transaction ID to peers */
+ ret = dict_get_bin (dict, "transaction_id",
+ (void **)&txn_id);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to get transaction id.");
+ goto out;
+ } else {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Transaction_id = %s", uuid_utoa (*txn_id));
+ uuid_copy (req.txn_id, *txn_id);
+ }
+
dummy_frame = create_frame (this, this->ctx->pool);
if (!dummy_frame)
goto out;
@@ -1454,6 +1468,7 @@ glusterd_vol_unlock (call_frame_t *frame, xlator_t *this,
glusterd_conf_t *priv = NULL;
call_frame_t *dummy_frame = NULL;
dict_t *dict = NULL;
+ uuid_t *txn_id = NULL;
if (!this)
goto out;
@@ -1480,6 +1495,19 @@ glusterd_vol_unlock (call_frame_t *frame, xlator_t *this,
goto out;
}
+ /* Sending valid transaction ID to peers */
+ ret = dict_get_bin (dict, "transaction_id",
+ (void **)&txn_id);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to get transaction id.");
+ goto out;
+ } else {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Transaction_id = %s", uuid_utoa (*txn_id));
+ uuid_copy (req.txn_id, *txn_id);
+ }
+
dummy_frame = create_frame (this, this->ctx->pool);
if (!dummy_frame)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index fe3cb1f..cb8f586 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -1462,7 +1462,7 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
uuid_generate (*txn_id);
ret = dict_set_bin (op_ctx, "transaction_id",
- txn_id, sizeof (uuid_t));
+ txn_id, sizeof(*txn_id));
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to set transaction id.");