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-rpc-ops.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c31
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c2
4 files changed, 21 insertions, 19 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index f7e8cfe248c..73646ec4bfc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -559,7 +559,7 @@ __glusterd_friend_remove_cbk (struct rpc_req * req, struct iovec *iov,
glusterd_friend_sm_event_type_t event_type = GD_FRIEND_EVENT_NONE;
glusterd_peerinfo_t *peerinfo = NULL;
int32_t op_ret = -1;
- int32_t op_errno = -1;
+ int32_t op_errno = 0;
glusterd_probe_ctx_t *ctx = NULL;
gf_boolean_t move_sm_now = _gf_true;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 19173a4d015..73014651d3b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -3455,7 +3455,7 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
ret = glusterd_volinfo_new (&new_volinfo);
if (ret)
goto out;
- strncpy (new_volinfo->volname, volname, sizeof (new_volinfo->volname));
+ strncpy (new_volinfo->volname, volname, strlen (volname));
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s%d.type", prefix, count);
@@ -7129,19 +7129,6 @@ glusterd_friend_remove_cleanup_vols (uuid_t uuid)
cds_list_for_each_entry_safe (volinfo, tmp_volinfo, &priv->volumes,
vol_list) {
- if (glusterd_friend_contains_vol_bricks (volinfo, uuid) == 2) {
- gf_msg (THIS->name, GF_LOG_INFO, 0,
- GD_MSG_STALE_VOL_DELETE_INFO,
- "Deleting stale volume %s", volinfo->volname);
- ret = glusterd_delete_volume (volinfo);
- if (ret) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0,
- GD_MSG_STALE_VOL_REMOVE_FAIL,
- "Error deleting stale volume");
- goto out;
- }
- }
-
if (!glusterd_friend_contains_vol_bricks (volinfo,
MY_UUID)) {
/*Stop snapd daemon service if snapd daemon is running*/
@@ -7155,6 +7142,20 @@ glusterd_friend_remove_cleanup_vols (uuid_t uuid)
}
}
}
+
+ if (glusterd_friend_contains_vol_bricks (volinfo, uuid) == 2) {
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ GD_MSG_STALE_VOL_DELETE_INFO,
+ "Deleting stale volume %s", volinfo->volname);
+ ret = glusterd_delete_volume (volinfo);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_STALE_VOL_REMOVE_FAIL,
+ "Error deleting stale volume");
+ goto out;
+ }
+ }
+
}
/* Reconfigure all daemon services upon peer detach */
@@ -7386,7 +7387,7 @@ glusterd_defrag_info_set (glusterd_volinfo_t *volinfo, dict_t *dict, int cmd,
rebal->defrag_status = status;
rebal->op = op;
- if (!rebal->rebalance_id)
+ if (gf_uuid_is_null (rebal->rebalance_id))
return;
if (is_origin_glusterd (dict)) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 3806127f00c..b56e9f26379 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -3728,7 +3728,8 @@ build_distribute:
goto out;
}
if (volinfo->tier_info.hot_brick_count) {
- strcpy (tmp_volname, volinfo->volname);
+ strncpy (tmp_volname, volinfo->volname,
+ strlen (volinfo->volname));
if (volinfo->tier_info.cur_tier_hot)
strcat (volinfo->volname, "-hot");
else
@@ -5170,7 +5171,7 @@ glusterd_is_valid_volfpath (char *volname, char *brick)
ret = 0;
goto out;
}
- strncpy (volinfo->volname, volname, sizeof (volinfo->volname));
+ strncpy (volinfo->volname, volname, strlen (volname));
get_brick_filepath (volfpath, volinfo, brickinfo, NULL);
ret = ((strlen(volfpath) < PATH_MAX) &&
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 60577505cfc..72e14b0429d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -2156,7 +2156,7 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
goto out;
}
- strncpy (volinfo->volname, volname, sizeof(volinfo->volname));
+ strncpy (volinfo->volname, volname, strlen (volname));
GF_ASSERT (volinfo->volname);
ret = dict_get_int32 (dict, "type", &volinfo->type);