summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2014-04-30 11:12:40 +0530
committerKaushal M <kaushal@redhat.com>2014-05-12 04:37:03 -0700
commite64dd0a358e7a7b4c0da86a6b17adf6f125c00d5 (patch)
tree36db6dd9895651c827f36f3cb7943426c2672fe2
parent4f905163211f8d439c6e102d3ffd1bffb34f5c26 (diff)
glusterd : barrier enable/disable should fail if already enabled/disabled
In barrier notify function, if we fail to set the barrier option execution goes to default_notify which returns 0 and command returns success. Fix : We need not call the default_notify function when handling GF_EVENT_TRANSLATOR_OP in barrier xlator's notify. Change-Id: Ia2c361b43cca7791c29829d69dcd6fc7923102f6 BUG: 1092841 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/7609 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Sachin Pandit <spandit@redhat.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
-rw-r--r--tests/bugs/bug-1092841.t24
-rw-r--r--xlators/features/barrier/src/barrier.c12
2 files changed, 33 insertions, 3 deletions
diff --git a/tests/bugs/bug-1092841.t b/tests/bugs/bug-1092841.t
new file mode 100644
index 00000000000..6740c318d9c
--- /dev/null
+++ b/tests/bugs/bug-1092841.t
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+cleanup;
+
+TEST glusterd;
+TEST pidof glusterd;
+TEST $CLI volume info;
+
+TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2};
+
+TEST $CLI volume start $V0;
+
+TEST $CLI volume barrier $V0 enable;
+
+TEST ! $CLI volume barrier $V0 enable;
+
+TEST $CLI volume barrier $V0 disable;
+
+TEST ! $CLI volume barrier $V0 disable;
+
+cleanup
diff --git a/xlators/features/barrier/src/barrier.c b/xlators/features/barrier/src/barrier.c
index a6867f6f45f..74973499d56 100644
--- a/xlators/features/barrier/src/barrier.c
+++ b/xlators/features/barrier/src/barrier.c
@@ -351,8 +351,13 @@ notify (xlator_t *this, int event, void *data, ...)
case GF_EVENT_TRANSLATOR_OP:
{
dict = data;
- GF_OPTION_RECONF ("barrier", barrier_enabled, dict,
- bool, out);
+ barrier_enabled = dict_get_str_boolean (dict, "barrier", -1);
+
+ if (barrier_enabled == -1) {
+ gf_log (this->name, GF_LOG_ERROR, "Could not fetch "
+ " barrier key from the dictionary.");
+ goto out;
+ }
LOCK (&priv->lock);
{
@@ -388,7 +393,8 @@ unlock:
if (!list_empty (&queue))
barrier_dequeue_all (this, &queue);
- // missing break is intentional
+
+ break;
}
default:
{