diff options
author | Krishnan Parthasarathi <kp@gluster.com> | 2011-05-03 02:05:38 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-05-04 05:00:07 -0700 |
commit | f5708f4d0696529faf1fb0ad108123a76c816d78 (patch) | |
tree | 891e603c0865f33fbdd7eaf253b9a5e14b03d45b | |
parent | 53af855f2aad8c19f2bbc7561534b473ae8c7dc4 (diff) |
glusterd: Cleaned up 'store' if vol create fails.
glusterd's internal 'store' needs to be cleaned up if
volume creation operation fails.
Signed-off-by: Krishnan Parthasarathi <kp@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2847 (volume creation fails if brick path is long)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2847
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index b88370b2979..b89e9b60253 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2531,6 +2531,7 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) char *volname = NULL; glusterd_conf_t *priv = NULL; glusterd_volinfo_t *volinfo = NULL; + gf_boolean_t vol_added = _gf_false; glusterd_brickinfo_t *brickinfo = NULL; xlator_t *this = NULL; char *brick = NULL; @@ -2655,6 +2656,7 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT); if (ret) { + glusterd_store_delete_volume (volinfo); *op_errstr = gf_strdup ("Failed to store the Volume information"); goto out; } @@ -2673,10 +2675,12 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) volinfo->defrag_status = 0; list_add_tail (&volinfo->vol_list, &priv->volumes); + vol_added = _gf_true; out: if (free_ptr) GF_FREE(free_ptr); - + if (!vol_added && volinfo) + glusterd_volinfo_delete (volinfo); return ret; } |