summaryrefslogtreecommitdiffstats
path: root/xlators/features/index
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2017-08-09 16:34:39 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-08-23 13:09:47 +0000
commitee3d9ac7f2db3a4aa9186e08b5a1db62c3270188 (patch)
tree70fce6f1aabcc57d465c427bd292e9936928a259 /xlators/features/index
parentd165ffd7a5e19fa6d0c2f36be9b47280e3df8443 (diff)
glusterd: do not create .glusterfs/indices
glusterd shouldn't concern itself with creating directories specific to certain xlators. The index xlator will now proceed creating './glusterfs/indices' dir only if the parent '.glusterfs' directory exists, which still fixes the original problem reported i.e 'volume start force' command shouldn't create brick path if it doesn't exist (BUG 1457202) This reverts most of the changes done by the commit b58a15948fb3fc37b6c0b70171482f50ed957f42 Change-Id: I7fc52ad64dce220e336c218fb4d85933ca2e61c0 Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: https://review.gluster.org/18003 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/features/index')
-rw-r--r--xlators/features/index/src/index.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index 8590482a5b3..12f98974fc3 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -15,6 +15,7 @@
#include "common-utils.h"
#include "index-messages.h"
#include <ftw.h>
+#include <libgen.h> /* for dirname() */
#include <signal.h>
#define XATTROP_SUBDIR "xattrop"
@@ -2285,6 +2286,8 @@ init (xlator_t *this)
char *watchlist = NULL;
char *dirtylist = NULL;
char *pendinglist = NULL;
+ char *index_base_parent = NULL;
+ char *tmp = NULL;
if (!this->children || this->children->next) {
gf_msg (this->name, GF_LOG_ERROR, EINVAL,
@@ -2336,12 +2339,14 @@ init (xlator_t *this)
}
GF_OPTION_INIT ("index-base", priv->index_basepath, path, out);
- if (gf_lstat_dir (priv->index_basepath, NULL) != 0) {
+ tmp = gf_strdup(priv->index_basepath);
+ index_base_parent = dirname(tmp);
+ if (gf_lstat_dir (index_base_parent, NULL) != 0) {
ret = -1;
gf_msg (this->name, GF_LOG_ERROR, errno,
INDEX_MSG_INDEX_DIR_CREATE_FAILED,
- "Failed to find index basepath %s.",
- priv->index_basepath);
+ "Failed to find parent dir (%s) of index basepath %s.",
+ index_base_parent, priv->index_basepath);
goto out;
}
@@ -2414,6 +2419,8 @@ init (xlator_t *this)
ret = 0;
out:
+ GF_FREE(tmp);
+
if (ret) {
if (cond_inited)
pthread_cond_destroy (&priv->cond);