3604df
From 39a250e3f16cd0182e330918096833457e0daea3 Mon Sep 17 00:00:00 2001
3604df
From: Avra Sengupta <asengupt@redhat.com>
3604df
Date: Mon, 12 Dec 2016 16:41:23 +0530
3604df
Subject: [PATCH 239/246] glusterd: Handle volinfo->refcnt properly during
3604df
 volume start command
3604df
3604df
While running the volume start command, the refcnt of the volume is
3604df
incremented. At the end of the command, the refcnt should also be
3604df
decremented. This is currently not the case.
3604df
3604df
This patch, makes sure the refcnt is also decremented at the end of the volume start command.
3604df
3604df
> Reviewed-on: http://review.gluster.org/16108
3604df
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
> Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
3604df
(cherry picked from commit 9b1c9395a397e337e4a0acac55b935cb1ce094b7)
3604df
3604df
Change-Id: I017b5039be5948df41dde6bc89d2955d5d18971f
3604df
BUG: 1403770
3604df
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/92782
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 20 ++++++++++----------
3604df
 1 file changed, 10 insertions(+), 10 deletions(-)
3604df
3604df
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
3604df
index 35336e2..d157734 100644
3604df
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
3604df
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
3604df
@@ -1512,6 +1512,15 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr,
3604df
                 goto out;
3604df
         }
3604df
 
3604df
+        /* This is an incremental approach to have all the volinfo objects ref
3604df
+         * count. The first attempt is made in volume start transaction to
3604df
+         * ensure it doesn't race with import volume where stale volume is
3604df
+         * deleted. There are multiple instances of GlusterD crashing in
3604df
+         * bug-948686.t because of this. Once this approach is full proof, all
3604df
+         * other volinfo objects will be refcounted.
3604df
+         */
3604df
+        glusterd_volinfo_ref (volinfo);
3604df
+
3604df
         if (priv->op_version > GD_OP_VERSION_3_7_5) {
3604df
                 ret = glusterd_validate_quorum (this, GD_OP_START_VOLUME, dict,
3604df
                                                 op_errstr);
3604df
@@ -1523,15 +1532,6 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr,
3604df
                 }
3604df
         }
3604df
 
3604df
-        /* This is an incremental approach to have all the volinfo objects ref
3604df
-         * count. The first attempt is made in volume start transaction to
3604df
-         * ensure it doesn't race with import volume where stale volume is
3604df
-         * deleted. There are multiple instances of GlusterD crashing in
3604df
-         * bug-948686.t because of this. Once this approach is full proof, all
3604df
-         * other volinfo objects will be refcounted.
3604df
-         */
3604df
-        glusterd_volinfo_ref (volinfo);
3604df
-
3604df
         ret = glusterd_validate_volume_id (dict, volinfo);
3604df
         if (ret)
3604df
                 goto out;
3604df
@@ -2668,7 +2668,7 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
3604df
         ret = glusterd_svcs_manager (volinfo);
3604df
 
3604df
 out:
3604df
-        if (!volinfo)
3604df
+        if (volinfo)
3604df
                 glusterd_volinfo_unref (volinfo);
3604df
 
3604df
         gf_msg_trace (this->name, 0, "returning %d ", ret);
3604df
-- 
3604df
2.9.3
3604df