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