diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2010-09-02 07:57:45 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-02 09:50:16 -0700 |
commit | 64c230aebd867c84a8320f1d98976bb102727413 (patch) | |
tree | 6aaff847048a0af6f5a5678244330381860d75b0 | |
parent | 588d807bdcbf5ed4df4d903428ab701479e9f8ac (diff) |
check if the export directory is present only on the brick being added
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1510 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1510
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 24 |
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++; |