From ec35b79f746d8a9451d7a3b9894025fdad7382f4 Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Thu, 9 Apr 2009 03:53:26 -0700 Subject: Erase xattr during self-heal based on original dict. Decrement xattr during self-heal based on the original dict instead of pending_matrix, as the pending_matrix might have been altered later. Signed-off-by: Anand V. Avati --- xlators/cluster/afr/src/afr-self-heal-common.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heal-common.c') diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 518907ac78a..eba1099b329 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -466,12 +466,16 @@ out: void -afr_sh_pending_to_delta (int32_t *pending_matrix[], int32_t *delta_matrix[], - int success[], int child_count) +afr_sh_pending_to_delta (dict_t **xattr, char *key, + int32_t *delta_matrix[], int success[], + int child_count) { int i = 0; int j = 0; + int32_t * pending = NULL; + int ret = 0; + /* start clean */ for (i = 0; i < child_count; i++) { for (j = 0; j < child_count; j++) { @@ -480,10 +484,20 @@ afr_sh_pending_to_delta (int32_t *pending_matrix[], int32_t *delta_matrix[], } for (i = 0; i < child_count; i++) { + pending = NULL; + + ret = dict_get_ptr (xattr[i], (char *) key, + VOID (&pending)); + for (j = 0; j < child_count; j++) { if (!success[j]) continue; - delta_matrix[i][j] = -pending_matrix[i][j]; + + if (pending) { + delta_matrix[i][j] = -(ntoh32 (pending[j])); + } else { + delta_matrix[i][j] = 0; + } } } } -- cgit