74b1de
From c429d3c63601e6ea15af76aa684c30bbeb746467 Mon Sep 17 00:00:00 2001
74b1de
From: Mohammed Rafi KC <rkavunga@redhat.com>
74b1de
Date: Tue, 23 Apr 2019 13:03:28 +0530
74b1de
Subject: [PATCH 120/124] glusterd/shd: Keep a ref on volinfo until attach rpc
74b1de
 execute cbk
74b1de
74b1de
When svc attach execute for multiplexing a daemon, we have to keep
74b1de
a ref on volinfo until it finish the execution. Because, if the attach
74b1de
is an aysnc call, then a parallel volume delete can lead to free the
74b1de
volinfo
74b1de
74b1de
> upstream patch : https://review.gluster.org/#/c/glusterfs/+/22606/
74b1de
74b1de
>Change-Id: Ibc02b89557baaed2f63db63d7fb1a7480444ae0d
74b1de
>fixes: bz#1702185
74b1de
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
74b1de
74b1de
Change-Id: Ibc02b89557baaed2f63db63d7fb1a7480444ae0d
74b1de
BUG: 1702240
74b1de
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/168616
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
74b1de
---
74b1de
 xlators/mgmt/glusterd/src/glusterd-shd-svc.c    | 3 +++
74b1de
 xlators/mgmt/glusterd/src/glusterd-svc-helper.c | 4 ++++
74b1de
 2 files changed, 7 insertions(+)
74b1de
74b1de
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
74b1de
index 19eca9f..a9eab42 100644
74b1de
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
74b1de
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
74b1de
@@ -452,8 +452,11 @@ glusterd_shdsvc_start(glusterd_svc_t *svc, int flags)
74b1de
     }
74b1de
 
74b1de
     if (shd->attached) {
74b1de
+        glusterd_volinfo_ref(volinfo);
74b1de
+        /* Unref will happen from glusterd_svc_attach_cbk */
74b1de
         ret = glusterd_attach_svc(svc, volinfo, flags);
74b1de
         if (ret) {
74b1de
+            glusterd_volinfo_unref(volinfo);
74b1de
             gf_msg("glusterd", GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL,
74b1de
                    "Failed to attach shd svc(volume=%s) to pid=%d. Starting"
74b1de
                    "a new process",
74b1de
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
74b1de
index 02945b1..f7be394 100644
74b1de
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
74b1de
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
74b1de
@@ -695,6 +695,10 @@ out:
74b1de
     if (flag) {
74b1de
         GF_FREE(flag);
74b1de
     }
74b1de
+
74b1de
+    if (volinfo)
74b1de
+        glusterd_volinfo_unref(volinfo);
74b1de
+
74b1de
     GF_ATOMIC_DEC(conf->blockers);
74b1de
     STACK_DESTROY(frame->root);
74b1de
     return 0;
74b1de
-- 
74b1de
1.8.3.1
74b1de