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