From 59401a32de51cdb6c1a5a1208723e89e1a4abd30 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Thu, 15 Oct 2015 16:08:03 +0530 Subject: snapshot: Fix snapshot clone postvalidate In glusterd_snapshot_clone_postvalidate(), we were deleting snap object and snap vol, by looking up snapname. Hence, it was deleting the orignal snapshot from which the clone was being created Instead it should fetch the clonename, the respective clone vol, and its corresponding snap object, and delete them. Also glusterd_snap_remove(), needs to differentiate a clone snap object from a snaphsot snap object, as in case of a clone snap object, we don't have any persisted data in /var/run/gluster/snaps/ and hence is shouldn't try to delete anything there. Change-Id: I02bb22a3898d5720e318a02d6cc32d25f75d317d BUG: 1272339 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/12364 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: mohammed rafi kc Reviewed-by: Rajesh Joseph --- xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index 5833e5ec593..1d64e6e980c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -1030,7 +1030,8 @@ glusterd_perform_missed_op (glusterd_snap_t *snap, int32_t op) switch (op) { case GF_SNAP_OPTION_TYPE_DELETE: - ret = glusterd_snap_remove (dict, snap, _gf_true, _gf_false); + ret = glusterd_snap_remove (dict, snap, _gf_true, _gf_false, + _gf_false); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_SNAP_REMOVE_FAIL, @@ -1630,7 +1631,7 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count, "The snap(%s) is scheduled to be decommissioned " "Not accepting the snap.", peer_snap_name); glusterd_snap_remove (dict, snap, - _gf_true, _gf_true); + _gf_true, _gf_true, _gf_false); ret = 0; goto out; } @@ -1708,7 +1709,7 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count, out: if (ret) glusterd_snap_remove (dict, snap, - _gf_true, _gf_true); + _gf_true, _gf_true, _gf_false); if (dict) dict_unref (dict); @@ -1935,7 +1936,8 @@ remove_my_data: goto out; } - ret = glusterd_snap_remove (dict, snap, remove_lvm, _gf_false); + ret = glusterd_snap_remove (dict, snap, remove_lvm, _gf_false, + _gf_false); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_SNAP_REMOVE_FAIL, -- cgit