From eba1fb05791f1424f68998cf2175cad1ce6098de Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Thu, 19 Jun 2014 05:06:53 +0000 Subject: 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 Reviewed-on: http://review.gluster.org/8119 Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri Tested-by: Pranith Kumar Karampuri --- xlators/features/index/src/index.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'xlators') 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); -- cgit