summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitrot.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c11
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c15
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-peer-utils.c8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-peer-utils.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c63
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c56
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c2
11 files changed, 84 insertions, 87 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitrot.c b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
index c653249cbb2..9959a59e40c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-bitrot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
@@ -319,7 +319,7 @@ glusterd_bitrot_expiry_time(glusterd_volinfo_t *volinfo, dict_t *dict,
int32_t ret = -1;
uint32_t expiry_time = 0;
xlator_t *this = NULL;
- char dkey[1024] = {
+ char dkey[32] = {
0,
};
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index a26260d0350..76b7684538f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -1730,9 +1730,10 @@ glusterd_store_slave_in_info(glusterd_volinfo_t *volinfo, char *slave,
char *value = NULL;
char *slavekey = NULL;
char *slaveentry = NULL;
- char key[512] = {
+ char key[32] = {
0,
};
+ int keylen;
char *t = NULL;
xlator_t *this = NULL;
struct slave_vol_config slave1 = {
@@ -1810,15 +1811,15 @@ glusterd_store_slave_in_info(glusterd_volinfo_t *volinfo, char *slave,
if (ret == 0) { /* New slave */
dict_foreach(volinfo->gsync_slaves, _get_max_gsync_slave_num, &maxslv);
- snprintf(key, sizeof(key), "slave%d", maxslv + 1);
+ keylen = snprintf(key, sizeof(key), "slave%d", maxslv + 1);
- ret = dict_set_dynstr(volinfo->gsync_slaves, key, value);
+ ret = dict_set_dynstrn(volinfo->gsync_slaves, key, keylen, value);
if (ret) {
GF_FREE(value);
goto out;
}
} else if (ret == -1) { /* Existing slave */
- snprintf(key, sizeof(key), "slave%d", slave1.old_slvidx);
+ keylen = snprintf(key, sizeof(key), "slave%d", slave1.old_slvidx);
gf_msg_debug(this->name, 0,
"Replacing key:%s with new value"
@@ -1826,7 +1827,7 @@ glusterd_store_slave_in_info(glusterd_volinfo_t *volinfo, char *slave,
key, value);
/* Add new slave's value, with the same slave index */
- ret = dict_set_dynstr(volinfo->gsync_slaves, key, value);
+ ret = dict_set_dynstrn(volinfo->gsync_slaves, key, keylen, value);
if (ret) {
GF_FREE(value);
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index b390f6e65e1..1c03f7580cd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -2649,7 +2649,7 @@ __glusterd_handle_friend_update(rpcsvc_request_t *req)
{0},
};
dict_t *dict = NULL;
- char key[100] = {
+ char key[32] = {
0,
};
int keylen;
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 2e57539033e..68166998b49 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3182,10 +3182,11 @@ _add_remove_bricks_to_dict(dict_t *dict, glusterd_volinfo_t *volinfo,
int ret = -1;
int count = 0;
int i = 0;
- char brick_key[1024] = {
+ char brick_key[16] = {
0,
};
- char dict_key[1024] = {
+ char dict_key[64] = {
+ /* dict_key is small as prefix is up to 32 chars */
0,
};
int keylen;
@@ -3250,7 +3251,7 @@ static int
_add_task_to_dict(dict_t *dict, glusterd_volinfo_t *volinfo, int op, int index)
{
int ret = -1;
- char key[64] = {
+ char key[32] = {
0,
};
int keylen;
@@ -4468,7 +4469,7 @@ glusterd_op_volume_dict_uuid_to_hostname(dict_t *dict, const char *key_fmt,
{
int ret = -1;
int i = 0;
- char key[1024];
+ char key[128];
int keylen;
char *uuid_str = NULL;
uuid_t uuid = {
@@ -6557,12 +6558,12 @@ fill_shd_status_for_local_bricks(dict_t *dict, glusterd_volinfo_t *volinfo,
dict_t *req_dict)
{
glusterd_brickinfo_t *brickinfo = NULL;
- char *msg = "self-heal-daemon is not running on";
- char key[1024] = {
+ static char *msg = "self-heal-daemon is not running on";
+ char key[32] = {
0,
};
int keylen;
- char value[1024] = {
+ char value[128] = {
0,
};
int ret = 0;
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
index 1a55a5a5375..82acf5bf03c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
@@ -823,7 +823,7 @@ gd_peerinfo_from_dict(dict_t *dict, const char *prefix)
xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
glusterd_peerinfo_t *new_peer = NULL;
- char key[100] = {
+ char key[64] = {
0,
};
char *uuid_str = NULL;
@@ -868,14 +868,14 @@ out:
return new_peer;
}
-int
+static int
gd_add_peer_hostnames_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *dict,
const char *prefix)
{
int ret = -1;
xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
- char key[256] = {
+ char key[64] = {
0,
};
glusterd_peer_hostname_t *addr = NULL;
@@ -917,7 +917,7 @@ gd_add_peer_detail_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *friends,
int count)
{
int ret = -1;
- char key[64] = {
+ char key[32] = {
0,
};
int keylen;
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.h b/xlators/mgmt/glusterd/src/glusterd-peer-utils.h
index 375fdf94607..fd254d57391 100644
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.h
@@ -72,9 +72,6 @@ glusterd_peerinfo_t *
gd_peerinfo_from_dict(dict_t *dict, const char *prefix);
int
-gd_add_peer_hostnames_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *dict,
- const char *prefix);
-int
gd_add_peer_detail_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *friends,
int count);
glusterd_peerinfo_t *
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index 5c2595cc852..43735d33fee 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -200,7 +200,7 @@ glusterd_snap_volinfo_restore(dict_t *dict, dict_t *rsp_dict,
int32_t volcount)
{
char *value = NULL;
- char key[PATH_MAX] = "";
+ char key[64] = "";
int32_t brick_count = -1;
int32_t ret = -1;
xlator_t *this = NULL;
@@ -2854,19 +2854,21 @@ out:
return quorum_met;
}
-int32_t
+static int32_t
glusterd_volume_quorum_check(glusterd_volinfo_t *volinfo, int64_t index,
- dict_t *dict, char *key_prefix, int8_t snap_force,
- int quorum_count, char *quorum_type,
- char **op_errstr, uint32_t *op_errno)
+ dict_t *dict, const char *key_prefix,
+ int8_t snap_force, int quorum_count,
+ char *quorum_type, char **op_errstr,
+ uint32_t *op_errno)
{
int ret = 0;
xlator_t *this = NULL;
int64_t i = 0;
int64_t j = 0;
- char key[1024] = {
+ char key[128] = {
0,
- };
+ }; /* key_prefix is passed from above, but is really quite small */
+ int keylen;
int down_count = 0;
gf_boolean_t first_brick_on = _gf_true;
glusterd_conf_t *priv = NULL;
@@ -2895,9 +2897,10 @@ glusterd_volume_quorum_check(glusterd_volinfo_t *volinfo, int64_t index,
with replica count 2, quorum is not met if even
one of its subvolumes is down
*/
- snprintf(key, sizeof(key), "%s%" PRId64 ".brick%" PRId64 ".status",
- key_prefix, index, i);
- ret = dict_get_int32(dict, key, &brick_online);
+ keylen = snprintf(key, sizeof(key),
+ "%s%" PRId64 ".brick%" PRId64 ".status",
+ key_prefix, index, i);
+ ret = dict_get_int32n(dict, key, keylen, &brick_online);
if (ret || !brick_online) {
ret = 1;
gf_msg(this->name, GF_LOG_ERROR, 0,
@@ -2920,10 +2923,10 @@ glusterd_volume_quorum_check(glusterd_volinfo_t *volinfo, int64_t index,
ret = 1;
quorum_met = _gf_false;
for (i = 0; i < volinfo->dist_leaf_count; i++) {
- snprintf(key, sizeof(key),
- "%s%" PRId64 ".brick%" PRId64 ".status", key_prefix,
- index, (j * volinfo->dist_leaf_count) + i);
- ret = dict_get_int32(dict, key, &brick_online);
+ keylen = snprintf(
+ key, sizeof(key), "%s%" PRId64 ".brick%" PRId64 ".status",
+ key_prefix, index, (j * volinfo->dist_leaf_count) + i);
+ ret = dict_get_int32n(dict, key, keylen, &brick_online);
if (ret || !brick_online) {
if (i == 0)
first_brick_on = _gf_false;
@@ -2954,9 +2957,9 @@ out:
return ret;
}
-int32_t
+static int32_t
glusterd_snap_common_quorum_calculate(glusterd_volinfo_t *volinfo, dict_t *dict,
- int64_t index, char *key_prefix,
+ int64_t index, const char *key_prefix,
int8_t snap_force,
gf_boolean_t snap_volume,
char **op_errstr, uint32_t *op_errno)
@@ -3005,9 +3008,10 @@ glusterd_snap_common_quorum_calculate(glusterd_volinfo_t *volinfo, dict_t *dict,
quorum_count = volinfo->brick_count;
}
- ret = dict_get_str(volinfo->dict, "cluster.quorum-type", &quorum_type);
+ ret = dict_get_str_sizen(volinfo->dict, "cluster.quorum-type",
+ &quorum_type);
if (!ret && !strcmp(quorum_type, "fixed")) {
- ret = dict_get_int32(volinfo->dict, "cluster.quorum-count", &tmp);
+ ret = dict_get_int32_sizen(volinfo->dict, "cluster.quorum-count", &tmp);
/* if quorum-type option is not found in the
dict assume auto quorum type. i.e n/2 + 1.
The same assumption is made when quorum-count
@@ -3049,12 +3053,12 @@ out:
return ret;
}
-int32_t
+static int32_t
glusterd_snap_quorum_check_for_clone(dict_t *dict, gf_boolean_t snap_volume,
char **op_errstr, uint32_t *op_errno)
{
const char err_str[] = "glusterds are not in quorum";
- char key_prefix[PATH_MAX] = {
+ char key_prefix[16] = {
0,
};
char *snapname = NULL;
@@ -3063,9 +3067,6 @@ glusterd_snap_quorum_check_for_clone(dict_t *dict, gf_boolean_t snap_volume,
glusterd_volinfo_t *tmp_volinfo = NULL;
char *volname = NULL;
int64_t volcount = 0;
- char key[PATH_MAX] = {
- 0,
- };
int64_t i = 0;
int32_t ret = -1;
xlator_t *this = NULL;
@@ -3080,7 +3081,7 @@ glusterd_snap_quorum_check_for_clone(dict_t *dict, gf_boolean_t snap_volume,
}
if (snap_volume) {
- ret = dict_get_str(dict, "snapname", &snapname);
+ ret = dict_get_str_sizen(dict, "snapname", &snapname);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"failed to "
@@ -3122,9 +3123,7 @@ glusterd_snap_quorum_check_for_clone(dict_t *dict, gf_boolean_t snap_volume,
}
for (i = 1; i <= volcount; i++) {
- snprintf(key, sizeof(key), "%s%" PRId64,
- snap_volume ? "snap-volname" : "volname", i);
- ret = dict_get_str(dict, "clonename", &volname);
+ ret = dict_get_str_sizen(dict, "clonename", &volname);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"failed to "
@@ -3171,14 +3170,14 @@ out:
return ret;
}
-int32_t
+static int32_t
glusterd_snap_quorum_check_for_create(dict_t *dict, gf_boolean_t snap_volume,
char **op_errstr, uint32_t *op_errno)
{
int8_t snap_force = 0;
int32_t force = 0;
const char err_str[] = "glusterds are not in quorum";
- char key_prefix[PATH_MAX] = {
+ char key_prefix[16] = {
0,
};
char *snapname = NULL;
@@ -3186,7 +3185,7 @@ glusterd_snap_quorum_check_for_create(dict_t *dict, gf_boolean_t snap_volume,
glusterd_volinfo_t *volinfo = NULL;
char *volname = NULL;
int64_t volcount = 0;
- char key[PATH_MAX] = {
+ char key[32] = {
0,
};
int64_t i = 0;
@@ -3313,7 +3312,7 @@ glusterd_snap_quorum_check(dict_t *dict, gf_boolean_t snap_volume,
goto out;
}
- ret = dict_get_int32(dict, "type", &snap_command);
+ ret = dict_get_int32_sizen(dict, "type", &snap_command);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"unable to get the type of "
@@ -3963,7 +3962,7 @@ glusterd_restore_geo_rep_files(glusterd_volinfo_t *snap_vol)
char *origin_volname = NULL;
glusterd_volinfo_t *origin_vol = NULL;
int i = 0;
- char key[PATH_MAX] = "";
+ char key[32] = "";
char session[PATH_MAX] = "";
char slave[PATH_MAX] = "";
char snapgeo_dir[PATH_MAX] = "";
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 97bd9ec511d..4703a072294 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -704,14 +704,14 @@ out:
return op_ret;
}
-int32_t
+static int32_t
glusterd_copy_geo_rep_files(glusterd_volinfo_t *origin_vol,
glusterd_volinfo_t *snap_vol, dict_t *rsp_dict)
{
int32_t ret = -1;
int i = 0;
xlator_t *this = NULL;
- char key[PATH_MAX] = "";
+ char key[32] = "";
char session[PATH_MAX] = "";
char slave[PATH_MAX] = "";
char snapgeo_dir[PATH_MAX] = "";
@@ -1927,7 +1927,7 @@ glusterd_snap_create_clone_common_prevalidate(
{
char *device = NULL;
char *orig_device = NULL;
- char key[PATH_MAX] = "";
+ char key[128] = "";
int ret = -1;
int64_t i = 1;
int64_t brick_order = 0;
@@ -2126,7 +2126,6 @@ glusterd_snapshot_clone_prevalidate(dict_t *dict, char **op_errstr,
char *clonename = NULL;
char *snapname = NULL;
char device_name[64] = "";
- char key[PATH_MAX] = "";
glusterd_snap_t *snap = NULL;
char err_str[PATH_MAX] = "";
int ret = -1;
@@ -2189,8 +2188,7 @@ glusterd_snapshot_clone_prevalidate(dict_t *dict, char **op_errstr,
goto out;
}
- snprintf(key, sizeof(key) - 1, "vol1_volid");
- ret = dict_get_bin(dict, key, (void **)&snap_volid);
+ ret = dict_get_bin(dict, "vol1_volid", (void **)&snap_volid);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
"Unable to fetch snap_volid");
@@ -3039,11 +3037,11 @@ out:
static int
glusterd_snapshot_get_snapvol_detail(dict_t *dict, glusterd_volinfo_t *snap_vol,
- char *keyprefix, int detail)
+ const char *keyprefix, const int detail)
{
int ret = -1;
int snap_limit = 0;
- char key[PATH_MAX] = "";
+ char key[64] = ""; /* keyprefix is quite small, up to 32 byts */
int keylen;
char *value = NULL;
glusterd_volinfo_t *origin_vol = NULL;
@@ -3206,11 +3204,12 @@ out:
static int
glusterd_snapshot_get_snap_detail(dict_t *dict, glusterd_snap_t *snap,
- char *keyprefix, glusterd_volinfo_t *volinfo)
+ const char *keyprefix,
+ glusterd_volinfo_t *volinfo)
{
int ret = -1;
int volcount = 0;
- char key[PATH_MAX] = "";
+ char key[32] = ""; /* keyprefix is quite small, up to 16 bytes */
int keylen;
char timestr[64] = "";
char *value = NULL;
@@ -3374,7 +3373,7 @@ glusterd_snapshot_get_all_snap_info(dict_t *dict)
{
int ret = -1;
int snapcount = 0;
- char key[64] = "";
+ char key[16] = "";
glusterd_snap_t *snap = NULL;
glusterd_snap_t *tmp_snap = NULL;
glusterd_conf_t *priv = NULL;
@@ -3421,7 +3420,7 @@ glusterd_snapshot_get_info_by_volume(dict_t *dict, char *volname, char *err_str,
int snapcount = 0;
int snap_limit = 0;
char *value = NULL;
- char key[64] = "";
+ char key[16] = "";
glusterd_volinfo_t *volinfo = NULL;
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *tmp_vol = NULL;
@@ -3719,7 +3718,7 @@ glusterd_snapshot_get_vol_snapnames(dict_t *dict, glusterd_volinfo_t *volinfo)
int ret = -1;
int snapcount = 0;
char *snapname = NULL;
- char key[PATH_MAX] = "";
+ char key[32] = "";
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *tmp_vol = NULL;
xlator_t *this = NULL;
@@ -5512,12 +5511,12 @@ out:
return ret;
}
-int32_t
+static int32_t
glusterd_handle_snapshot_delete_all(dict_t *dict)
{
int32_t ret = -1;
int32_t i = 0;
- char key[PATH_MAX] = "";
+ char key[32] = "";
glusterd_conf_t *priv = NULL;
glusterd_snap_t *snap = NULL;
glusterd_snap_t *tmp_snap = NULL;
@@ -7115,10 +7114,10 @@ out:
return ret;
}
-int
+static int
glusterd_get_brick_lvm_details(dict_t *rsp_dict,
glusterd_brickinfo_t *brickinfo, char *volname,
- char *device, char *key_prefix)
+ char *device, const char *key_prefix)
{
int ret = -1;
glusterd_conf_t *priv = NULL;
@@ -7130,7 +7129,7 @@ glusterd_get_brick_lvm_details(dict_t *rsp_dict,
char buf[PATH_MAX] = "";
char *ptr = NULL;
char *token = NULL;
- char key[PATH_MAX] = "";
+ char key[160] = ""; /* key_prefix is 128 bytes at most */
char *value = NULL;
GF_ASSERT(rsp_dict);
@@ -7258,16 +7257,16 @@ out:
return ret;
}
-int
+static int
glusterd_get_single_brick_status(char **op_errstr, dict_t *rsp_dict,
- char *keyprefix, int index,
+ const char *keyprefix, int index,
glusterd_volinfo_t *snap_volinfo,
glusterd_brickinfo_t *brickinfo)
{
int ret = -1;
xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- char key[PATH_MAX] = "";
+ char key[128] = ""; /* keyprefix is not longer than 64 bytes */
int keylen;
char *device = NULL;
char *value = NULL;
@@ -7432,13 +7431,13 @@ out:
return ret;
}
-int
+static int
glusterd_get_single_snap_status(char **op_errstr, dict_t *rsp_dict,
- char *keyprefix, glusterd_snap_t *snap)
+ const char *keyprefix, glusterd_snap_t *snap)
{
int ret = -1;
xlator_t *this = NULL;
- char key[PATH_MAX] = "";
+ char key[64] = ""; /* keyprefix is "status.snap0" */
int keylen;
char brickkey[PATH_MAX] = "";
glusterd_volinfo_t *snap_volinfo = NULL;
@@ -7513,12 +7512,13 @@ out:
return ret;
}
-int
+static int
glusterd_get_each_snap_object_status(char **op_errstr, dict_t *rsp_dict,
- glusterd_snap_t *snap, char *keyprefix)
+ glusterd_snap_t *snap,
+ const char *keyprefix)
{
int ret = -1;
- char key[PATH_MAX] = "";
+ char key[32] = ""; /* keyprefix is "status.snap0" */
int keylen;
char *temp = NULL;
xlator_t *this = NULL;
@@ -9860,7 +9860,7 @@ glusterd_snapshot_get_volnames_uuids(dict_t *dict, char *volname,
{
int ret = -1;
int snapcount = 0;
- char key[PATH_MAX] = "";
+ char key[32] = "";
glusterd_volinfo_t *snap_vol = NULL;
glusterd_volinfo_t *volinfo = NULL;
glusterd_volinfo_t *tmp_vol = NULL;
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index e3a9274e8db..458df8dbd1d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -2336,7 +2336,7 @@ glusterd_store_retrieve_bricks(glusterd_volinfo_t *volinfo)
glusterd_conf_t *priv = NULL;
int32_t brick_count = 0;
int32_t ta_brick_count = 0;
- char tmpkey[4096] = {
+ char tmpkey[32] = {
0,
};
gf_store_iter_t *tmpiter = NULL;
@@ -2648,14 +2648,13 @@ glusterd_store_retrieve_bricks(glusterd_volinfo_t *volinfo)
goto out;
if (volinfo->thin_arbiter_count == 1) {
+ snprintf(tmpkey, sizeof(tmpkey), "%s-%d",
+ GLUSTERD_STORE_KEY_VOL_TA_BRICK, 0);
while (ta_brick_count < volinfo->subvol_count) {
ret = glusterd_brickinfo_new(&ta_brickinfo);
if (ret)
goto out;
- snprintf(tmpkey, sizeof(tmpkey), "%s-%d",
- GLUSTERD_STORE_KEY_VOL_TA_BRICK, 0);
-
ret = gf_store_iter_get_matching(tmpiter, tmpkey, &tmpvalue);
len = snprintf(path, sizeof(path), "%s/%s", brickdir, tmpvalue);
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index fd3b3e9d382..44367922876 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -10123,7 +10123,7 @@ glusterd_volume_status_add_peer_rsp(dict_t *this, char *key, data_t *value,
if (len < 0 || len >= sizeof(new_key))
goto out;
- ret = dict_set(rsp_ctx->dict, new_key, new_value);
+ ret = dict_setn(rsp_ctx->dict, new_key, len, new_value);
out:
if (ret) {
data_unref(new_value);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index b2bb24653dd..849cac4f0d9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -2085,7 +2085,7 @@ glusterd_op_create_volume(dict_t *dict, char **op_errstr)
0,
};
char *brick_mount_dir = NULL;
- char key[PATH_MAX] = "";
+ char key[64] = "";
char *address_family_str = NULL;
struct statvfs brickstat = {
0,