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