From 1e3a8f47cd88c39c41519d143b001d45387eb4b8 Mon Sep 17 00:00:00 2001 From: Ashish Pandey Date: Fri, 17 Jun 2016 17:52:56 +0530 Subject: cluster/ec: Handle absence of keys in some callback dict Problem: This issue arises when we do a rolling update from 3.7.5 to 3.7.9. For 4+2 volume running 3.7.5, if we update 2 nodes and after heal completion kill 2 older nodes, this problem can be seen. After update and killing of bricks, 2 nodes will return inodelk count key in dict while other 2 nodes will not have inodelk count in dict. This is also true for get-link-count. During dictionary match , ec_dict_compare, this will lead to mismatch of answers and the file operation on mount point will fail with IO error. Solution: Don't match inode, entry and link count keys while comparing two dictionaries. However, while combining the data in ec_dict_combine, go through all the dictionaries and select the maximum values received in different dicts for these keys. master- http://review.gluster.org/#/c/14761/ Change-Id: I33546e3619fe8f909286ee48fb0df2009cd3d22f BUG: 1360152 Signed-off-by: Ashish Pandey Reviewed-on: http://review.gluster.org/14761 Reviewed-by: Xavier Hernandez Smoke: Gluster Build System Reviewed-by: Pranith Kumar Karampuri CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Signed-off-by: Ashish Pandey Reviewed-on: http://review.gluster.org/15012 --- xlators/cluster/ec/src/ec-combine.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c index 4afbc5bb2b6..e609ada98b4 100644 --- a/xlators/cluster/ec/src/ec-combine.c +++ b/xlators/cluster/ec/src/ec-combine.c @@ -245,6 +245,9 @@ gf_boolean_t ec_xattr_match (dict_t *dict, char *key, data_t *value, void *arg) { if ((fnmatch(GF_XATTR_STIME_PATTERN, key, 0) == 0) || + (strcmp(key, GET_LINK_COUNT) == 0) || + (strcmp(key, GLUSTERFS_INODELK_COUNT) == 0) || + (strcmp(key, GLUSTERFS_ENTRYLK_COUNT) == 0) || (strcmp(key, GLUSTERFS_OPEN_FD_COUNT) == 0)) { return _gf_false; } @@ -285,8 +288,8 @@ ec_dict_compare (dict_t *dict1, dict_t *dict2) int32_t ec_dict_list(data_t ** list, int32_t * count, ec_cbk_data_t * cbk, int32_t which, char * key) { - ec_cbk_data_t * ans; - dict_t * dict; + ec_cbk_data_t *ans = NULL; + dict_t *dict = NULL; int32_t i, max; max = *count; @@ -672,6 +675,10 @@ int32_t ec_dict_data_combine(dict_t * dict, char * key, data_t * value, return ec_dict_data_merge(data->cbk, data->which, key); } + if (strcmp(key, GET_LINK_COUNT) == 0) { + return ec_dict_data_max32(data->cbk, data->which, key); + } + if (strcmp(key, GLUSTERFS_OPEN_FD_COUNT) == 0) { return ec_dict_data_max32(data->cbk, data->which, key); @@ -708,7 +715,7 @@ int32_t ec_dict_data_combine(dict_t * dict, char * key, data_t * value, int32_t ec_dict_combine(ec_cbk_data_t * cbk, int32_t which) { - dict_t * dict; + dict_t *dict = NULL; ec_dict_combine_t data; int32_t err = 0; -- cgit