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>
This commit is contained in:
Krishnan Parthasarathi 2014-12-18 09:18:12 +05:30
parent 94dacaa4e9
commit f7a8bd08c8

View File

@ -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;
glusterd_volinfo_t *volinfo = NULL;
priv = THIS->private;
snprintf (pathname, 1024, "%s/vols/%s", priv->workdir,
volname);
ret = stat (pathname, &stbuf);
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 *