From f7a8bd08c80a33a9e2459b47e203a8bc841abc54 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Thu, 18 Dec 2014 09:18:12 +0530 Subject: glusterd: check_volume_exists should query in-memory representation ... instead of consulting the on-disk data directory. There is no reason why the on-disk is more accurate than the in-memory representation. In fact, it is the other way around when a node is reconciling volume/cluster configuration with the rest of the cluster. Change-Id: I786823efdf1d0f6b9e6fcdb72d51e5227c399ce1 BUG: 1176770 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/9292 Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-utils.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index be96884d098..787352e93f6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -418,26 +418,9 @@ out: gf_boolean_t glusterd_check_volume_exists (char *volname) { - char pathname[1024] = {0,}; - struct stat stbuf = {0,}; - int32_t ret = -1; - glusterd_conf_t *priv = NULL; - - priv = THIS->private; - - snprintf (pathname, 1024, "%s/vols/%s", priv->workdir, - volname); - - ret = stat (pathname, &stbuf); + glusterd_volinfo_t *volinfo = NULL; - if (ret) { - gf_log (THIS->name, GF_LOG_DEBUG, "Volume %s does not exist." - "stat failed with errno : %d on path: %s", - volname, errno, pathname); - return _gf_false; - } - - return _gf_true; + return (glusterd_volinfo_find (volname, &volinfo) == 0); } glusterd_volinfo_t * -- cgit