diff options
| author | Vikas Gorur <vikas@gluster.com> | 2009-04-09 03:53:59 -0700 | 
|---|---|---|
| committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-09 18:57:05 +0530 | 
| commit | bfbcde78924fc5847b31ae56fe8d14ea52b60dfd (patch) | |
| tree | 1c6b4565606c57548971ad569e0ef22b37e2da72 /xlators | |
| parent | ec35b79f746d8a9451d7a3b9894025fdad7382f4 (diff) | |
Handle files which have no pending xattrs at all.
If a pending xattr key is non-existent on a file (call such
files 'ignorant'), make all other non-ignorant subvolumes point
towards the ignorant one.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators')
| -rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 28 | 
1 files changed, 27 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index eba1099b3..58ea4fdb9 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -183,6 +183,10 @@ afr_sh_build_pending_matrix (int32_t *pending_matrix[], dict_t *xattr[],  	int32_t *pending = NULL;  	int ret = -1; +        unsigned char *ignorant_subvols = NULL; + +        ignorant_subvols = CALLOC (sizeof (*ignorant_subvols), child_count); +  	/* start clean */  	for (i = 0; i < child_count; i++) {  		for (j = 0; j < child_count; j++) { @@ -198,13 +202,35 @@ afr_sh_build_pending_matrix (int32_t *pending_matrix[], dict_t *xattr[],  		ret = dict_get_ptr (xattr[i], (char *) key,  				    VOID(&pending)); -		if (ret != 0) +		if (ret != 0) { +                        /* +                         * There is no xattr present. This means this +                         * subvolume should be considered an 'ignorant' +                         * subvolume. +                         */ + +                        ignorant_subvols[i] = 1;  			continue; +                }  		for (j = 0; j < child_count; j++) {  			pending_matrix[i][j] = ntoh32 (pending[j]);  		}  	} + +        /* +         * Make all non-ignorant subvols point towards the ignorant +         * subvolumes. +         */ + +        for (i = 0; i < child_count; i++) { +                if (ignorant_subvols[i]) { +                        for (j = 0; j < child_count; j++) { +                                if (!ignorant_subvols[j]) +                                        pending_matrix[j][i] += 1; +                        } +                } +        }  }  | 
