summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2015-08-12 15:25:03 +0530
committerVenky Shankar <vshankar@redhat.com>2015-08-23 21:31:51 -0700
commita586b30c1bd968d23562406cefbb76b82a0e236c (patch)
tree6b9521a9909a2c4ac2536d7da60b1d49498e0ab8 /xlators/features
parentd80537d8e588da57db609332c2d89873e0a368ca (diff)
features/bitrot: Fix scrubber frequency set
When bitrot is configured on multiple volumes in a cluster and scrubber-frequency is changed for one volume, it is resetting frequency for all other volumes w.r.t to its scrubber-frequency. This should not happen. Changing scrubber-frequency should affect only that volume on which it is set. This patch fixes the issue. Also restricted the logs to the configure volume. Change-Id: I90d6e864b131e3d8dd4010079a00f924032f2098 BUG: 1252825 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/11897 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot-scrub.c24
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot.h3
2 files changed, 22 insertions, 5 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
index 322d27f069e..c5f44b5b52f 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
@@ -830,6 +830,9 @@ br_fsscan_reschedule (xlator_t *this, br_child_t *child)
fsscan = &child->fsscan;
fsscrub = &priv->fsscrub;
+ if (!fsscrub->frequency_reconf)
+ return 0;
+
(void) gettimeofday (&now, NULL);
timo = br_fsscan_calculate_timeout (fsscrub->frequency);
if (timo == 0) {
@@ -1185,6 +1188,7 @@ br_scrubber_handle_throttle (xlator_t *this, br_private_t *priv,
scrub_throttle_t nthrottle = BR_SCRUB_THROTTLE_VOID;
fsscrub = &priv->fsscrub;
+ fsscrub->throttle_reconf = _gf_false;
ret = br_scrubber_fetch_option (this, "scrub-throttle", options, &tmp);
if (ret)
@@ -1209,6 +1213,9 @@ br_scrubber_handle_throttle (xlator_t *this, br_private_t *priv,
if (ret)
goto error_return;
+ if (fsscrub->throttle != nthrottle)
+ fsscrub->throttle_reconf = _gf_true;
+
fsscrub->throttle = nthrottle;
return 0;
@@ -1246,6 +1253,7 @@ br_scrubber_handle_freq (xlator_t *this, br_private_t *priv,
struct br_scrubber *fsscrub = NULL;
fsscrub = &priv->fsscrub;
+ fsscrub->frequency_reconf = _gf_true;
ret = br_scrubber_fetch_option (this, "scrub-freq", options, &tmp);
if (ret)
@@ -1269,7 +1277,11 @@ br_scrubber_handle_freq (xlator_t *this, br_private_t *priv,
} else
goto error_return;
- fsscrub->frequency = frequency;
+ if (fsscrub->frequency == frequency)
+ fsscrub->frequency_reconf = _gf_false;
+ else
+ fsscrub->frequency = frequency;
+
return 0;
error_return:
@@ -1297,10 +1309,12 @@ static void br_scrubber_log_option (xlator_t *this,
if (scrubstall)
return; /* logged as pause */
- gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_TUNABLE, "SCRUB "
- "TUNABLES:: [Frequency: %s, Throttle: %s]",
- scrub_freq_str[fsscrub->frequency],
- scrub_throttle_str[fsscrub->throttle]);
+ if (fsscrub->frequency_reconf || fsscrub->throttle_reconf) {
+ gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_TUNABLE,
+ "SCRUB TUNABLES:: [Frequency: %s, Throttle: %s]",
+ scrub_freq_str[fsscrub->frequency],
+ scrub_throttle_str[fsscrub->throttle]);
+ }
}
int32_t
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.h b/xlators/features/bit-rot/src/bitd/bit-rot.h
index 308f8c03a73..7def0606726 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.h
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.h
@@ -137,6 +137,9 @@ struct br_scrubber {
*/
scrub_freq_t frequency;
+ gf_boolean_t frequency_reconf;
+ gf_boolean_t throttle_reconf;
+
pthread_mutex_t mutex;
pthread_cond_t cond;