e3c68b
From 321080e55f0ae97115a9542ba5de8494e7610860 Mon Sep 17 00:00:00 2001
e3c68b
From: Mohammed Rafi KC <rkavunga@redhat.com>
e3c68b
Date: Tue, 14 May 2019 23:12:44 +0530
e3c68b
Subject: [PATCH 167/169] glusterd/shd: Optimize the glustershd manager to send
e3c68b
 reconfigure
e3c68b
e3c68b
Traditionally all svc manager will execute process stop and then
e3c68b
followed by start each time when they called. But that is not
e3c68b
required by shd, because the attach request implemented in the shd
e3c68b
multiplex has the intelligence to check whether a detach is required
e3c68b
prior to attaching the graph. So there is no need to send an explicit
e3c68b
detach request if we are sure that the next call is an attach request
e3c68b
e3c68b
Upstream patch: https://review.gluster.org/#/c/glusterfs/+/22729/
e3c68b
>Change-Id: I9157c8dcaffdac038f73286bcf5646a3f1d3d8ec
e3c68b
>fixes: bz#1710054
e3c68b
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
e3c68b
e3c68b
Change-Id: I56aaaf3b4d28215307e160c1ba0e09bb74c30fbe
e3c68b
BUG: 1716865
e3c68b
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
e3c68b
Reviewed-on: https://code.engineering.redhat.com/gerrit/172289
e3c68b
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e3c68b
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
e3c68b
---
e3c68b
 libglusterfs/src/graph.c                     | 1 -
e3c68b
 xlators/mgmt/glusterd/src/glusterd-shd-svc.c | 9 +++++----
e3c68b
 2 files changed, 5 insertions(+), 5 deletions(-)
e3c68b
e3c68b
diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c
e3c68b
index 18fb2d9..27d9335 100644
e3c68b
--- a/libglusterfs/src/graph.c
e3c68b
+++ b/libglusterfs/src/graph.c
e3c68b
@@ -1497,7 +1497,6 @@ glusterfs_process_svc_detach(glusterfs_ctx_t *ctx, gf_volfile_t *volfile_obj)
e3c68b
         parent_graph->last_xl = glusterfs_get_last_xlator(parent_graph);
e3c68b
         parent_graph->xl_count -= graph->xl_count;
e3c68b
         parent_graph->leaf_count -= graph->leaf_count;
e3c68b
-        default_notify(xl, GF_EVENT_PARENT_DOWN, xl);
e3c68b
         parent_graph->id++;
e3c68b
         ret = 0;
e3c68b
     }
e3c68b
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
e3c68b
index 981cc87..d81d760 100644
e3c68b
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
e3c68b
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
e3c68b
@@ -311,10 +311,11 @@ glusterd_shdsvc_manager(glusterd_svc_t *svc, void *data, int flags)
e3c68b
          */
e3c68b
         ret = svc->stop(svc, SIGTERM);
e3c68b
     } else if (volinfo) {
e3c68b
-        ret = svc->stop(svc, SIGTERM);
e3c68b
-        if (ret)
e3c68b
-            goto out;
e3c68b
-
e3c68b
+        if (volinfo->status != GLUSTERD_STATUS_STARTED) {
e3c68b
+            ret = svc->stop(svc, SIGTERM);
e3c68b
+            if (ret)
e3c68b
+                goto out;
e3c68b
+        }
e3c68b
         if (volinfo->status == GLUSTERD_STATUS_STARTED) {
e3c68b
             ret = svc->start(svc, flags);
e3c68b
             if (ret)
e3c68b
-- 
e3c68b
1.8.3.1
e3c68b