diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2015-10-09 22:31:28 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2015-11-17 06:36:17 -0800 |
commit | 0f35b301fcb539dd85a1dae202b3ce532852d4d6 (patch) | |
tree | dd6bb7928e85042bb2779f19c2cd645b7e7bd20b /xlators/mgmt/glusterd/src/glusterd-volume-ops.c | |
parent | 052bdb5899bb723b6d375c66ab2ceab028adab06 (diff) |
tests: spurious failure fix for bug-948686.t
Ensured import volume and volume start doesn't race in volinfo by refcounting
volinfo.
Change-Id: I7467eccaba9a00fd63ba0121d8157df24d1c00a6
BUG: 1258714
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/12329
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 75f11e742b6..d997d60cd18 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -1450,6 +1450,14 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, volname); 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); ret = glusterd_validate_volume_id (dict, volinfo); if (ret) @@ -1580,6 +1588,9 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, volinfo->caps = caps; ret = 0; out: + if (volinfo) + glusterd_volinfo_unref (volinfo); + if (ret && (msg[0] != '\0')) { gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_OP_STAGE_START_VOL_FAIL, "%s", msg); @@ -2463,6 +2474,14 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) volname); 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); /* A bricks mount dir is required only by snapshots which were * introduced in gluster-3.6.0 @@ -2537,6 +2556,9 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) ret = glusterd_svcs_manager (volinfo); out: + if (!volinfo) + glusterd_volinfo_unref (volinfo); + gf_msg_trace (this->name, 0, "returning %d ", ret); return ret; } |