diff options
author | Avra Sengupta <asengupt@redhat.com> | 2016-12-12 16:41:23 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2016-12-25 21:24:07 -0800 |
commit | e657973372c35de91fd447b74fd0229e60f24f42 (patch) | |
tree | 1e2bb51b61f3ee969ec444783beeebe1c2ccf7f8 | |
parent | d513f41ef8089a9df2fe1240dd9f1952b9a41767 (diff) |
glusterd: Handle volinfo->refcnt properly during volume start command
While running the volume start command, the refcnt of the volume is
incremented. At the end of the command, the refcnt should also be
decremented. This is currently not the case.
This patch, makes sure the refcnt is also decremented at the end of the
volume start command.
> Reviewed-on: http://review.gluster.org/16108
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
(cherry picked from commit 9b1c9395a397e337e4a0acac55b935cb1ce094b7)
Change-Id: I017b5039be5948df41dde6bc89d2955d5d18971f
BUG: 1404105
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/16114
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index b0a9372069e..bade4ffb06d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -1503,6 +1503,15 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, goto out; } + /* This is an incremental approach to have all the volinfo objects ref + * count. The first attempt is made in volume start transaction to + * ensure it doesn't race with import volume where stale volume is + * deleted. There are multiple instances of GlusterD crashing in + * bug-948686.t because of this. Once this approach is full proof, all + * other volinfo objects will be refcounted. + */ + glusterd_volinfo_ref (volinfo); + if (priv->op_version > GD_OP_VERSION_3_7_5) { ret = glusterd_validate_quorum (this, GD_OP_START_VOLUME, dict, op_errstr); @@ -1514,15 +1523,6 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, } } - /* This is an incremental approach to have all the volinfo objects ref - * count. The first attempt is made in volume start transaction to - * ensure it doesn't race with import volume where stale volume is - * deleted. There are multiple instances of GlusterD crashing in - * bug-948686.t because of this. Once this approach is full proof, all - * other volinfo objects will be refcounted. - */ - glusterd_volinfo_ref (volinfo); - ret = glusterd_validate_volume_id (dict, volinfo); if (ret) goto out; @@ -2659,7 +2659,7 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) ret = glusterd_svcs_manager (volinfo); out: - if (!volinfo) + if (volinfo) glusterd_volinfo_unref (volinfo); gf_msg_trace (this->name, 0, "returning %d ", ret); |