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