diff options
| -rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.c | 51 | ||||
| -rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.h | 2 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 10 | 
3 files changed, 31 insertions, 32 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 0ff4c0cb1fc..25ae530913d 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -20,8 +20,6 @@  #include "protocol-common.h"  #define SHD_INODE_LRU_LIMIT          2048 -#define AFR_EH_HEALED_LIMIT          1024 -#define AFR_EH_HEAL_FAIL_LIMIT       1024  #define AFR_EH_SPLIT_BRAIN_LIMIT     1024  #define AFR_STATISTICS_HISTORY_SIZE    50 @@ -314,30 +312,29 @@ afr_shd_selfheal (struct subvol_healer *healer, int child, uuid_t gfid)  		eh = shd->split_brain;  		crawl_event->split_brain_count++;  	} else if (ret < 0) { -		eh = shd->heal_failed;  		crawl_event->heal_failed_count++;  	} else if (ret == 0) { -		eh = shd->healed;  		crawl_event->healed_count++;  	}  	if (eh) {  		shd_event = GF_CALLOC (1, sizeof(*shd_event),  				       gf_afr_mt_shd_event_t); -		if (!shd_event) { -			GF_FREE (path); -			return ret; -		} +		if (!shd_event) +                        goto out;  		shd_event->child = child;  		shd_event->path = path; -		if (eh_save_history (eh, shd_event) < 0) { -			GF_FREE (shd_event); -			GF_FREE (path); -                        return ret; -		} +		if (eh_save_history (eh, shd_event) < 0) +                        goto out; + +                shd_event = NULL; +                path = NULL;  	} +out: +        GF_FREE (shd_event); +        GF_FREE (path);  	return ret;  } @@ -1055,16 +1052,6 @@ afr_selfheal_daemon_init (xlator_t *this)  			goto out;  	} -	shd->healed = eh_new (AFR_EH_HEALED_LIMIT, _gf_false, -			      afr_destroy_shd_event_data); -        if (!shd->healed) -		goto out; - -	shd->heal_failed = eh_new (AFR_EH_HEAL_FAIL_LIMIT, _gf_false, -				   afr_destroy_shd_event_data); -	if (!shd->heal_failed) -		goto out; -  	shd->split_brain = eh_new (AFR_EH_SPLIT_BRAIN_LIMIT, _gf_false,  				   afr_destroy_shd_event_data);  	if (!shd->split_brain) @@ -1168,7 +1155,7 @@ afr_xl_op (xlator_t *this, dict_t *input, dict_t *output)  		for (i = 0; i < priv->child_count; i++) {  			healer = &shd->index_healers[i]; -			snprintf (key, 64, "%d-%d-status", xl_id, i); +			snprintf (key, sizeof (key), "%d-%d-status", xl_id, i);  			if (!priv->child_up[i]) {  				ret = dict_set_str (output, key, @@ -1193,7 +1180,7 @@ afr_xl_op (xlator_t *this, dict_t *input, dict_t *output)  		for (i = 0; i < priv->child_count; i++) {  			healer = &shd->full_healers[i]; -			snprintf (key, 64, "%d-%d-status", xl_id, i); +			snprintf (key, sizeof (key), "%d-%d-status", xl_id, i);  			if (!priv->child_up[i]) {  				ret = dict_set_str (output, key, @@ -1219,10 +1206,12 @@ afr_xl_op (xlator_t *this, dict_t *input, dict_t *output)  				afr_shd_gather_index_entries (this, i, output);                  break;          case GF_AFR_OP_HEALED_FILES: -		eh_dump (shd->healed, output, afr_add_shd_event); -                break;          case GF_AFR_OP_HEAL_FAILED_FILES: -		eh_dump (shd->heal_failed, output, afr_add_shd_event); +                for (i = 0; i < priv->child_count; i++) { +                        snprintf (key, sizeof (key), "%d-%d-status", xl_id, i); +                        ret = dict_set_str (output, key, "Operation Not " +                                            "Supported"); +                }                  break;          case GF_AFR_OP_SPLIT_BRAIN_FILES:  		eh_dump (shd->split_brain, output, afr_add_shd_event); @@ -1243,11 +1232,13 @@ afr_xl_op (xlator_t *this, dict_t *input, dict_t *output)  		for (i = 0; i < priv->child_count; i++) {  			if (!priv->child_up[i]) { -				snprintf (key, 64, "%d-%d-status", xl_id, i); +				snprintf (key, sizeof (key), "%d-%d-status", +                                          xl_id, i);  				ret = dict_set_str (output, key,  						    "Brick is not connected");  			} else { -				snprintf (key, 64, "%d-%d-hardlinks", xl_id, i); +				snprintf (key, sizeof (key), "%d-%d-hardlinks", +                                          xl_id, i);  				cnt = afr_shd_get_index_count (this, i);  				if (cnt >= 0) {  					ret = dict_set_uint64 (output, key, cnt); diff --git a/xlators/cluster/afr/src/afr-self-heald.h b/xlators/cluster/afr/src/afr-self-heald.h index 10e229ee7c2..59f06b79cff 100644 --- a/xlators/cluster/afr/src/afr-self-heald.h +++ b/xlators/cluster/afr/src/afr-self-heald.h @@ -53,8 +53,6 @@ typedef struct {  	struct subvol_healer   *index_healers;  	struct subvol_healer   *full_healers; -	eh_t                    *healed; -        eh_t                    *heal_failed;          eh_t                    *split_brain;          eh_t                    **statistics;  } afr_self_heald_t; diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index fd19b78b912..1eff081516e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -1398,6 +1398,16 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr)          }          switch (heal_op) { +                case GF_AFR_OP_HEALED_FILES: +                case GF_AFR_OP_HEAL_FAILED_FILES: +                        ret = -1; +                        snprintf (msg, sizeof (msg),"Command not supported. " +                                  "Please use \"gluster volume heal %s info\" " +                                  "and logs to find the heal information.", +                                  volname); +                        *op_errstr = gf_strdup (msg); +                        goto out; +                  case GF_AFR_OP_INDEX_SUMMARY:                  case GF_AFR_OP_STATISTICS_HEAL_COUNT:                  case GF_AFR_OP_STATISTICS_HEAL_COUNT_PER_REPLICA:  | 
