From 5e25569ed0717aa8636ad708430a823d39f9aa60 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 5 Feb 2015 21:26:04 +0530 Subject: cluster/afr: Re-introduce heal-timeout option Change-Id: I87484c810006a92ed7489284b6d74e9b0aecae80 BUG: 1177601 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/9598 Tested-by: Gluster Build System Reviewed-by: Ravishankar N Reviewed-by: Krutika Dhananjay Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-self-heald.c | 2 +- xlators/cluster/afr/src/afr-self-heald.h | 1 + xlators/cluster/afr/src/afr.c | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 74998b97b63..f979f992660 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -129,7 +129,7 @@ __afr_shd_healer_wait (struct subvol_healer *healer) priv = healer->this->private; disabled_loop: - wait_till.tv_sec = time (NULL) + 60; + wait_till.tv_sec = time (NULL) + priv->shd.timeout; while (!healer->rerun) { ret = pthread_cond_timedwait (&healer->cond, diff --git a/xlators/cluster/afr/src/afr-self-heald.h b/xlators/cluster/afr/src/afr-self-heald.h index 02b26b8061f..58b088e4cd7 100644 --- a/xlators/cluster/afr/src/afr-self-heald.h +++ b/xlators/cluster/afr/src/afr-self-heald.h @@ -50,6 +50,7 @@ struct subvol_healer { typedef struct { gf_boolean_t iamshd; gf_boolean_t enabled; + int timeout; struct subvol_healer *index_healers; struct subvol_healer *full_healers; diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 2c0ff05fd78..8e0c2ebef23 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -200,6 +200,9 @@ reconfigure (xlator_t *this, dict_t *options) GF_OPTION_RECONF ("iam-self-heal-daemon", priv->shd.iamshd, options, bool, out); + GF_OPTION_RECONF ("heal-timeout", priv->shd.timeout, options, + int32, out); + priv->did_discovery = _gf_false; ret = 0; @@ -346,6 +349,7 @@ init (xlator_t *this) GF_OPTION_INIT ("self-heal-daemon", priv->shd.enabled, bool, out); GF_OPTION_INIT ("iam-self-heal-daemon", priv->shd.iamshd, bool, out); + GF_OPTION_INIT ("heal-timeout", priv->shd.timeout, int32, out); priv->wait_count = 1; @@ -749,5 +753,13 @@ struct volume_options options[] = { .type = GF_OPTION_TYPE_BOOL, .default_value = "off", }, + { .key = {"heal-timeout"}, + .type = GF_OPTION_TYPE_INT, + .min = 60, + .max = INT_MAX, + .default_value = "600", + .description = "time interval for checking the need to self-heal " + "in self-heal-daemon" + }, { .key = {NULL} }, }; -- cgit