summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2014-12-18 09:18:12 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-12-28 22:59:15 -0800
commitf7a8bd08c80a33a9e2459b47e203a8bc841abc54 (patch)
tree9d679a091bc512daced1a336b3f2dd7834c84ac9 /xlators/mgmt/glusterd/src/glusterd-utils.c
parent94dacaa4e91d11760666e9c4e4a6bdf39ae03c6b (diff)
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 <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/9292 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c21
1 files 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 *