summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c38
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c17
3 files changed, 47 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index 092283a7daf..6d90ecae3b1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -1321,6 +1321,10 @@ out:
gd_mgmt_v3_collate_errors (args, op_ret, op_errno, rsp.op_errstr,
GLUSTERD_MGMT_V3_COMMIT, *peerid, rsp.uuid);
GF_FREE (peerid);
+
+ if (rsp.op_errstr)
+ free (rsp.op_errstr);
+
/* req->rpc_status set to -1 means, STACK_DESTROY will be called from
* the caller function.
*/
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 6e4894b7344..05112763b88 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -2105,6 +2105,7 @@ glusterd_snap_create_clone_common_prevalidate (dict_t *rsp_dict, int flags,
int clone, uint32_t *op_errno)
{
char *device = NULL;
+ char *orig_device = NULL;
char key[PATH_MAX] = "";
int ret = -1;
int64_t i = 1;
@@ -2170,9 +2171,9 @@ glusterd_snap_create_clone_common_prevalidate (dict_t *rsp_dict, int flags,
}
- device = glusterd_get_brick_mount_device
- (brickinfo->path);
- if (!device) {
+ orig_device = glusterd_get_brick_mount_device
+ (brickinfo->path);
+ if (!orig_device) {
snprintf (err_str, PATH_MAX,
"getting device name for the brick "
"%s:%s failed", brickinfo->hostname,
@@ -2181,7 +2182,7 @@ glusterd_snap_create_clone_common_prevalidate (dict_t *rsp_dict, int flags,
goto out;
}
if (!clone) {
- if (!glusterd_is_thinp_brick (device, op_errno)) {
+ if (!glusterd_is_thinp_brick (orig_device, op_errno)) {
snprintf (err_str, PATH_MAX,
"Snapshot is supported only for "
"thin provisioned LV. Ensure that "
@@ -2189,10 +2190,10 @@ glusterd_snap_create_clone_common_prevalidate (dict_t *rsp_dict, int flags,
"provisioned LV.", volinfo->volname);
ret = -1;
goto out;
- }
+ }
}
- device = glusterd_build_snap_device_path (device,
+ device = glusterd_build_snap_device_path (orig_device,
snap_volname,
brick_count);
if (!device) {
@@ -2205,18 +2206,19 @@ glusterd_snap_create_clone_common_prevalidate (dict_t *rsp_dict, int flags,
goto out;
}
+ GF_FREE(orig_device);
+ orig_device = NULL;
+
snprintf (key, sizeof(key),
"vol%"PRId64".brick_snapdevice%"PRId64,
i, brick_count);
- ret = dict_set_dynstr (rsp_dict, key, device);
+ ret = dict_set_dynstr_with_alloc (rsp_dict, key, device);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED,
"Failed to set %s", key);
- GF_FREE (device);
goto out;
}
- device = NULL;
ret = glusterd_update_mntopts (brickinfo->path,
brickinfo);
@@ -2286,6 +2288,10 @@ glusterd_snap_create_clone_common_prevalidate (dict_t *rsp_dict, int flags,
}
brick_count++;
brick_order++;
+ if (device) {
+ GF_FREE(device);
+ device = NULL;
+ }
}
snprintf (key, sizeof(key) - 1, "vol%"PRId64"_brickcount", volcount);
ret = dict_set_int64 (rsp_dict, key, brick_count);
@@ -2297,8 +2303,11 @@ glusterd_snap_create_clone_common_prevalidate (dict_t *rsp_dict, int flags,
}
ret = 0;
out:
+ if (orig_device)
+ GF_FREE(orig_device);
+
if (device)
- GF_FREE (device);
+ GF_FREE (device);
return ret;
@@ -2831,6 +2840,9 @@ glusterd_do_lvm_snapshot_remove (glusterd_volinfo_t *snap_vol,
}
out:
+ if (mnt_pt)
+ GF_FREE(mnt_pt);
+
return ret;
}
@@ -4725,6 +4737,9 @@ glusterd_take_lvm_snapshot (glusterd_brickinfo_t *brickinfo,
}
out:
+ if (origin_device)
+ GF_FREE (origin_device);
+
return ret;
}
@@ -7391,6 +7406,9 @@ out:
GF_FREE (value);
}
+ if (device)
+ GF_FREE (device);
+
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 5bfa809b053..e89ed1102fe 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -865,6 +865,8 @@ glusterd_brickinfo_delete (glusterd_brickinfo_t *brickinfo)
cds_list_del_init (&brickinfo->brick_list);
+ (void) gf_store_handle_destroy (brickinfo->shandle);
+
GF_FREE (brickinfo->logfile);
GF_FREE (brickinfo);
@@ -926,6 +928,9 @@ glusterd_volinfo_delete (glusterd_volinfo_t *volinfo)
dict_unref (volinfo->rebal.dict);
gf_store_handle_destroy (volinfo->quota_conf_shandle);
+ gf_store_handle_destroy (volinfo->shandle);
+ gf_store_handle_destroy (volinfo->node_state_shandle);
+ gf_store_handle_destroy (volinfo->snapd.handle);
glusterd_auth_cleanup (volinfo);
@@ -1054,6 +1059,9 @@ glusterd_get_brick_mount_dir (char *brickpath, char *hostname, char *mount_dir)
}
out:
+ if (mnt_pt)
+ GF_FREE(mnt_pt);
+
gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -5601,7 +5609,8 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo,
ret = dict_set_dynstr_with_alloc (dict, key, entry->mnt_opts);
out:
- GF_FREE (mnt_pt);
+ if (mnt_pt)
+ GF_FREE (mnt_pt);
return ret;
}
@@ -5644,6 +5653,9 @@ glusterd_get_brick_mount_device (char *brick_path)
device = gf_strdup (entry->mnt_fsname);
out:
+ if (mnt_pt)
+ GF_FREE(mnt_pt);
+
return device;
}
@@ -10848,7 +10860,8 @@ glusterd_update_mntopts (char *brick_path, glusterd_brickinfo_t *brickinfo)
ret = 0;
out:
- GF_FREE (mnt_pt);
+ if (mnt_pt)
+ GF_FREE (mnt_pt);
return ret;
}