From 64c230aebd867c84a8320f1d98976bb102727413 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Thu, 2 Sep 2010 07:57:45 +0000 Subject: check if the export directory is present only on the brick being added Signed-off-by: Raghavendra Bhat Signed-off-by: Vijay Bellur BUG: 1510 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1510 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 24 +++++++++++++++++++----- 1 file 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++; -- cgit