From d1a277785af5d9d0e38d0576d2a9c69e27a232df Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Tue, 31 Aug 2010 08:57:19 +0000 Subject: check if the export directory is present only on the correct host Signed-off-by: Raghavendra Bhat Signed-off-by: Vijay Bellur BUG: 1489 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1489 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 37 +++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 3f819515a3f..c78c19fdef1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -306,9 +306,25 @@ glusterd_op_stage_create_volume (gd1_mgmt_stage_op_req *req) char *brick = NULL; char *tmpptr = NULL; char cmd_str[1024]; + xlator_t *this = NULL; + glusterd_conf_t *priv = NULL; GF_ASSERT (req); + this = THIS; + if (!this) { + gf_log ("glusterd", GF_LOG_ERROR, + "this is NULL"); + goto out; + } + + priv = this->private; + if (!priv) { + gf_log ("glusterd", GF_LOG_ERROR, + "priv is NULL"); + goto out; + } + dict = dict_new (); if (!dict) goto out; @@ -359,14 +375,23 @@ glusterd_op_stage_create_volume (gd1_mgmt_stage_op_req *req) if (ret) goto out; snprintf (cmd_str, 1024, "%s", brick_info->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, brick_info->path); + ret = glusterd_resolve_brick (brick_info); + if (ret) { + gf_log ("glusterd", GF_LOG_ERROR, + "cannot resolve brick"); goto out; } - brick_list = tmpptr; + + if (!uuid_compare (brick_info->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, brick_info->path); + goto out; + } + brick_list = tmpptr; + } } out: gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); -- cgit