summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot.c
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2015-01-16 14:28:09 +0530
committerKaushal M <kaushal@redhat.com>2015-03-30 02:43:36 -0700
commit7b3db6df564f1af1845b7f436e74ac6e838cd5b6 (patch)
tree5f4d9ebf42fbc4e00d25bf0508b73b3983eefd49 /xlators/mgmt/glusterd/src/glusterd-snapshot.c
parent3db5f3a41b7029ce8005d1e1cc01808a15cc6019 (diff)
glusterd: replace glusterd_volinfo_delete calls with glusterd_volinfo_unref
volinfo has its own ref counting mechanism. While deleting a volinfo object its always wiser to check there is 0 reference to it and then delete it. Change-Id: I446bd83432bd94aa19e29c6026367dfc1231786f BUG: 1183463 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/9462 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 7359040f18c..bcee5fbd862 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -2766,14 +2766,7 @@ glusterd_snap_volume_remove (dict_t *rsp_dict,
origin_vol->snap_count--;
}
- ret = glusterd_volinfo_delete (snap_vol);
- if (ret) {
- gf_log(this->name, GF_LOG_WARNING, "Failed to remove volinfo "
- "%s ", snap_vol->volname);
- save_ret = ret;
- if (!force)
- goto out;
- }
+ glusterd_volinfo_unref (snap_vol);
if (save_ret)
ret = save_ret;
@@ -7906,12 +7899,7 @@ glusterd_snapshot_revert_partial_restored_vol (glusterd_volinfo_t *volinfo)
/* Since we retrieved the volinfo from store now we don't
* want the older volinfo. Therefore delete the older volinfo */
- ret = glusterd_volinfo_delete (volinfo);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to delete volinfo");
- goto out;
- }
-
+ glusterd_volinfo_unref (volinfo);
ret = 0;
out:
return ret;
@@ -7995,7 +7983,7 @@ glusterd_snapshot_restore_postop (dict_t *dict, int32_t op_ret,
ret = dict_get_str (dict, "snapname", &name);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "getting the snap "
- "name failed (volume: %s)", volinfo->volname);
+ "name failed (volume: %s)", name);
goto out;
}