From 0988aa934898e2d44e21eab6aadc86bd7f5d97b3 Mon Sep 17 00:00:00 2001
From: Ashish Pandey <aspandey@redhat.com>
Date: Thu, 25 Jun 2015 16:30:40 +0530
Subject: [PATCH 142/190] EC : While Healing a file, set the config xattr
Problem : trusted.ec.config attr was missing for the healed file
Solution: Writing trusted.ec.config while healing a file.
Review link for master branch -
http://review.gluster.org/11407/
Change-Id: I340dd45ff8ab5bc1cd6e9b0cd2b2ded236e5acf0
BUG: 1235244
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/51658
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
---
xlators/cluster/ec/src/ec-heal.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
index af75c95..c2b8e11 100644
--- a/xlators/cluster/ec/src/ec-heal.c
+++ b/xlators/cluster/ec/src/ec-heal.c
@@ -2328,7 +2328,7 @@ ec_create_name (call_frame_t *frame, ec_t *ec, inode_t *parent, char *name,
unsigned char *create = NULL;
dict_t *xdata = NULL;
char *linkname = NULL;
-
+ ec_config_t config;
/* There should be just one gfid key */
EC_REPLIES_ALLOC (replies, ec->nodes);
if (gfid_db->count != 1) {
@@ -2422,6 +2422,19 @@ ec_create_name (call_frame_t *frame, ec_t *ec, inode_t *parent, char *name,
if (output1[i])
output[i] = 1;
break;
+ case IA_IFREG:
+ config.version = EC_CONFIG_VERSION;
+ config.algorithm = EC_CONFIG_ALGORITHM;
+ config.gf_word_size = EC_GF_BITS;
+ config.bricks = ec->nodes;
+ config.redundancy = ec->redundancy;
+ config.chunk_size = EC_METHOD_CHUNK_SIZE;
+
+ if (ec_dict_set_config(xdata, EC_XATTR_CONFIG,
+ &config) < 0) {
+ ret = -EIO;
+ goto out;
+ }
default:
ret = dict_set_int32 (xdata, GLUSTERFS_INTERNAL_FOP_KEY,
1);
--
1.7.1