From 60e8fdfeebb6005d3e3c310c720c2ff5e709f706 Mon Sep 17 00:00:00 2001 From: Rajesh Joseph Date: Fri, 13 Jun 2014 10:49:47 +0530 Subject: glusterd/snapshot: Fix for snapshot restore failure Problem: If restore fails due to quorum failure then the subsequent restore fails. Cause: Volume store is backed up during prevalidate failure and it is reverted or cleaned based on failure or success of the commit phase. In case of quorum failure we were not reverting the backup. Fix: Take backup when all the validation is done including quorum check. Change-Id: I55d57f6ee85fac04a0e6cbd0291a402601c725d6 BUG: 1109024 Signed-off-by: Rajesh Joseph Reviewed-on: http://review.gluster.org/8056 Reviewed-by: Sachin Pandit Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- xlators/mgmt/glusterd/src/glusterd-snapshot.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index af4cf171aff..330e50c277d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -768,6 +768,15 @@ glusterd_snapshot_restore (dict_t *dict, char **op_errstr, dict_t *rsp_dict) goto out; } + /* Take backup of the volinfo folder */ + ret = glusterd_snapshot_backup_vol (parent_volinfo); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, "Failed to backup " + "volume backend files for %s volume", + parent_volinfo->volname); + goto out; + } + if (is_origin_glusterd (dict) == _gf_true) { /* From origin glusterd check if * * any peers with snap bricks is down */ @@ -918,15 +927,6 @@ glusterd_snapshot_restore_prevalidate (dict_t *dict, char **op_errstr, ret = -1; goto out; } - - /* Take backup of the volinfo folder */ - ret = glusterd_snapshot_backup_vol (volinfo); - if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to backup " - "volume backend files for %s volume", - volinfo->volname); - goto out; - } } /* Get brickinfo for snap_volumes */ -- cgit