summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c15
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c14
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c14
5 files changed, 42 insertions, 16 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index a88729c0e6a..b48ea6f40fd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -1713,9 +1713,15 @@ glusterd_op_stage_sys_exec (dict_t *dict, char **op_errstr)
out:
if (ret) {
- if (errmsg[0] == '\0')
- snprintf (errmsg, sizeof (errmsg), "%s not found.",
- command);
+ if (errmsg[0] == '\0') {
+ if (command)
+ snprintf (errmsg, sizeof (errmsg),
+ "gsync peer_%s command not found.",
+ command);
+ else
+ snprintf (errmsg, sizeof (errmsg), "%s",
+ "gsync peer command was not specified");
+ }
*op_errstr = gf_strdup (errmsg);
gf_log ("", GF_LOG_ERROR, "%s", errmsg);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 5a98d497137..11e15c55f46 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -896,7 +896,7 @@ rb_generate_client_volfile (glusterd_volinfo_t *volinfo,
"%s", strerror (errno));
goto out;
}
- close (fd);
+ sys_close (fd);
file = fopen (filename, "w+");
if (!file) {
@@ -920,12 +920,14 @@ rb_generate_client_volfile (glusterd_volinfo_t *volinfo,
glusterd_auth_get_username (volinfo),
glusterd_auth_get_password (volinfo));
- fclose (file);
GF_FREE (ttype);
ret = 0;
out:
+ if (file)
+ fclose (file);
+
return ret;
}
@@ -969,13 +971,13 @@ rb_generate_dst_brick_volfile (glusterd_volinfo_t *volinfo,
priv->workdir, volinfo->volname,
RB_DSTBRICKVOL_FILENAME);
- fd = creat (filename, S_IRUSR | S_IWUSR);
+ fd = sys_creat (filename, S_IRUSR | S_IWUSR);
if (fd < 0) {
gf_log (this->name, GF_LOG_ERROR,
"%s", strerror (errno));
goto out;
}
- close (fd);
+ sys_close (fd);
file = fopen (filename, "w+");
if (!file) {
@@ -1005,11 +1007,12 @@ rb_generate_dst_brick_volfile (glusterd_volinfo_t *volinfo,
GF_FREE (trans_type);
- fclose (file);
-
ret = 0;
out:
+ if (file)
+ fclose (file);
+
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index ca047bd3322..6b30361e3d5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -246,7 +246,8 @@ glusterd_ac_reverse_probe_begin (glusterd_friend_sm_event_t *event, void *ctx)
out:
if (ret) {
GF_FREE (new_event);
- GF_FREE (new_ev_ctx->hostname);
+ if (new_ev_ctx)
+ GF_FREE (new_ev_ctx->hostname);
GF_FREE (new_ev_ctx);
}
gf_log ("", GF_LOG_DEBUG, "returning with %d", ret);
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 097613184a0..dbe31610d19 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -7403,6 +7403,20 @@ glusterd_snapshot_restore_postop (dict_t *dict, int32_t op_ret,
goto out;
}
+ ret = dict_get_str (dict, "snapname", &name);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "getting the snap "
+ "name failed (volume: %s)", volinfo->volname);
+ goto out;
+ }
+
+ snap = glusterd_find_snap_by_name (name);
+ if (!snap) {
+ gf_log (this->name, GF_LOG_ERROR, "snap %s is not found", name);
+ ret = -1;
+ goto out;
+ }
+
/* On success perform the cleanup operation */
if (0 == op_ret) {
ret = glusterd_snapshot_restore_cleanup (rsp_dict, volinfo,
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index e285a499a5c..6eaa5f6d05a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -4647,6 +4647,8 @@ glusterd_delete_stale_volume (glusterd_volinfo_t *stale_volinfo,
GF_ASSERT (stale_volinfo);
GF_ASSERT (valid_volinfo);
+ this = THIS;
+ GF_ASSERT (this);
/* Copy snap_volumes list from stale_volinfo to valid_volinfo */
valid_volinfo->snap_count = 0;
@@ -6822,12 +6824,12 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
int ret = -1;
xlator_t *this = NULL;
- if ((!brickinfo) || (!volinfo))
- goto out;
-
this = THIS;
GF_ASSERT (this);
+ if ((!brickinfo) || (!volinfo))
+ goto out;
+
if (uuid_is_null (brickinfo->uuid)) {
ret = glusterd_resolve_brick (brickinfo);
if (ret) {
@@ -7821,14 +7823,14 @@ glusterd_brick_stop (glusterd_volinfo_t *volinfo,
xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
- if ((!brickinfo) || (!volinfo))
- goto out;
-
this = THIS;
GF_ASSERT (this);
conf = this->private;
GF_ASSERT (conf);
+ if ((!brickinfo) || (!volinfo))
+ goto out;
+
if (uuid_is_null (brickinfo->uuid)) {
ret = glusterd_resolve_brick (brickinfo);
if (ret) {