summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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:
{