cb8e9e
From 8d7cb72921b983fbe2ab0a2bf166d5c57036e402 Mon Sep 17 00:00:00 2001
cb8e9e
From: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
cb8e9e
Date: Wed, 12 Aug 2015 14:27:58 +0530
cb8e9e
Subject: [PATCH 247/279] glusterd: Pass NULL in glusterd_svc_manager in glusterd_restart_bricks
cb8e9e
cb8e9e
On restarting glusterd quota daemon is not started when  more than one
cb8e9e
volumes are configured and quota is enabled only on 2nd volume.
cb8e9e
This is because of while restarting glusterd it will restart all the bricks.
cb8e9e
During brick restart it will start respective daemon by passing volinfo of
cb8e9e
first volume. Passing volinfo to glusterd_svc_manager will imply daemon
cb8e9e
managers will take action based on the same volume's configuration which
cb8e9e
is incorrect for per node daemons.
cb8e9e
cb8e9e
Fix is to pass volinfo NULL while restarting bricks.
cb8e9e
cb8e9e
Change-Id: I69f0df80dc56e1d2e2598ab143bf487743042d5d
cb8e9e
BUG: 1238071
cb8e9e
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
cb8e9e
Backport of: http://review.gluster.org/#/c/11658/
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/54970
cb8e9e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
Tested-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
---
cb8e9e
 .../bug-1242875-do-not-pass-volinfo-quota.t        |   38 ++++++++++++++++++++
cb8e9e
 tests/volume.rc                                    |    4 ++
cb8e9e
 xlators/mgmt/glusterd/src/glusterd-utils.c         |    2 +-
cb8e9e
 3 files changed, 43 insertions(+), 1 deletions(-)
cb8e9e
 create mode 100644 tests/bugs/glusterd/bug-1242875-do-not-pass-volinfo-quota.t
cb8e9e
cb8e9e
diff --git a/tests/bugs/glusterd/bug-1242875-do-not-pass-volinfo-quota.t b/tests/bugs/glusterd/bug-1242875-do-not-pass-volinfo-quota.t
cb8e9e
new file mode 100644
cb8e9e
index 0000000..c229d43
cb8e9e
--- /dev/null
cb8e9e
+++ b/tests/bugs/glusterd/bug-1242875-do-not-pass-volinfo-quota.t
cb8e9e
@@ -0,0 +1,38 @@
cb8e9e
+#!/bin/bash
cb8e9e
+
cb8e9e
+. $(dirname $0)/../../include.rc
cb8e9e
+. $(dirname $0)/../../volume.rc
cb8e9e
+. $(dirname $0)/../../cluster.rc
cb8e9e
+
cb8e9e
+cleanup;
cb8e9e
+
cb8e9e
+## Start glusterd
cb8e9e
+TEST glusterd;
cb8e9e
+TEST pidof glusterd;
cb8e9e
+
cb8e9e
+## Lets create volume V0 and start the volume
cb8e9e
+TEST $CLI volume create $V0 $H0:$B0/${V0}0 $H0:$B0/${V0}1
cb8e9e
+TEST $CLI volume start $V0
cb8e9e
+
cb8e9e
+## Lets create volume V1 and start the volume
cb8e9e
+TEST $CLI volume create $V1 $H0:$B0/${V0}2 $H0:$B0/${V0}3
cb8e9e
+TEST $CLI volume start $V1
cb8e9e
+
cb8e9e
+## Enable quota on 2nd volume
cb8e9e
+TEST $CLI volume quota $V1 enable
cb8e9e
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_quotad_count
cb8e9e
+
cb8e9e
+## Killing all gluster process
cb8e9e
+pkill gluster;
cb8e9e
+
cb8e9e
+## there should not be any quota daemon running after killing quota process
cb8e9e
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" get_quotad_count
cb8e9e
+
cb8e9e
+## Start glusterd
cb8e9e
+TEST glusterd;
cb8e9e
+TEST pidof glusterd;
cb8e9e
+
cb8e9e
+## Quotad daemon should start on restarting the glusterd
cb8e9e
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_quotad_count
cb8e9e
+
cb8e9e
+cleanup;
cb8e9e
diff --git a/tests/volume.rc b/tests/volume.rc
cb8e9e
index 09a8d51..570d87d 100644
cb8e9e
--- a/tests/volume.rc
cb8e9e
+++ b/tests/volume.rc
cb8e9e
@@ -543,6 +543,10 @@ function get_scrubd_count {
cb8e9e
         ps auxww | grep glusterfs | grep scrub.pid | grep -v grep | wc -l
cb8e9e
 }
cb8e9e
 
cb8e9e
+function get_quotad_count {
cb8e9e
+        ps auxww | grep glusterfs | grep quotad.pid | grep -v grep | wc -l
cb8e9e
+}
cb8e9e
+
cb8e9e
 function quota_list_field () {
cb8e9e
         local QUOTA_PATH=$1
cb8e9e
         local FIELD=$2
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
cb8e9e
index 7781773..5b9d5e3 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
cb8e9e
@@ -4488,7 +4488,7 @@ glusterd_restart_bricks (glusterd_conf_t *conf)
cb8e9e
                         continue;
cb8e9e
                 if (start_svcs == _gf_false) {
cb8e9e
                         start_svcs = _gf_true;
cb8e9e
-                        glusterd_svcs_manager (volinfo);
cb8e9e
+                        glusterd_svcs_manager (NULL);
cb8e9e
                 }
cb8e9e
                 gf_msg_debug (this->name, 0, "starting the volume %s",
cb8e9e
                         volinfo->volname);
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e