summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index fe3a3abd2d3..dbeb07ff58d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -654,9 +654,14 @@ glusterd_op_stage_add_brick (gd1_mgmt_stage_op_req *req)
glusterd_volinfo_t *volinfo = NULL;
struct stat st_buf = {0,};
char cmd_str[1024];
+ glusterd_conf_t *priv = NULL;
GF_ASSERT (req);
+ priv = THIS->private;
+ if (!priv)
+ goto out;
+
dict = dict_new ();
if (!dict)
goto out;
@@ -717,14 +722,23 @@ glusterd_op_stage_add_brick (gd1_mgmt_stage_op_req *req)
}
}
snprintf (cmd_str, 1024, "%s", brickinfo->path);
- ret = stat (cmd_str, &st_buf);
- if (ret == -1) {
- gf_log ("glusterd", GF_LOG_ERROR, "Volname %s, brick"
- ":%s path %s not present", volname,
- brick, brickinfo->path);
+ ret = glusterd_resolve_brick (brickinfo);
+ if (ret) {
+ gf_log ("glusterd", GF_LOG_ERROR,
+ "resolve brick failed");
goto out;
}
+ if (!uuid_compare (brickinfo->uuid, priv->uuid)) {
+ ret = stat (cmd_str, &st_buf);
+ if (ret == -1) {
+ gf_log ("glusterd", GF_LOG_ERROR, "Volname %s, brick"
+ ":%s path %s not present", volname,
+ brick, brickinfo->path);
+ goto out;
+ }
+ }
+
glusterd_brickinfo_delete (brickinfo);
brick = strtok_r (NULL, " \n", &saveptr);
i++;