summaryrefslogtreecommitdiffstats
path: root/xlators/features/index/src
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2014-06-19 05:06:53 +0000
committerPranith Kumar Karampuri <pkarampu@redhat.com>2014-06-20 05:56:52 -0700
commiteba1fb05791f1424f68998cf2175cad1ce6098de (patch)
tree12e25999b60859649090fc440872d4e9bc2e788b /xlators/features/index/src
parentd0547a28f59d80ed572652af3e327b761c4e540f (diff)
features/index: Don't delete current xattrop index.
Delete the base entry in indices/xattrop only when it is stale. Change-Id: I675c1510dd8293d068e31b552b0de48f50aac658 BUG: 1101647 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/8119 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/features/index/src')
-rw-r--r--xlators/features/index/src/index.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index 4b2eb2e29ba..2b80e718607 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -238,6 +238,15 @@ make_file_path (char *base, const char *subdir, const char *filename,
"/%s", filename);
}
+static int
+is_index_file_current (char *filename, uuid_t priv_index)
+{
+ char *current_index = alloca (strlen ("xattrop-") + GF_UUID_BUF_SIZE);
+
+ sprintf (current_index, "xattrop-%s", uuid_utoa(priv_index));
+ return (!strcmp(filename, current_index));
+}
+
static void
check_delete_stale_index_file (xlator_t *this, char *filename)
{
@@ -247,6 +256,10 @@ check_delete_stale_index_file (xlator_t *this, char *filename)
index_priv_t *priv = NULL;
priv = this->private;
+
+ if (is_index_file_current (filename, priv->index))
+ return;
+
make_file_path (priv->index_basepath, XATTROP_SUBDIR,
filename, filepath, sizeof (filepath));
ret = stat (filepath, &st);