diff options
author | Kotresh HR <khiremat@redhat.com> | 2015-08-12 15:25:03 +0530 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2015-08-27 02:18:32 -0700 |
commit | 3b63a2eb7f9a67360564cf949de6e7a0e7313153 (patch) | |
tree | 00d45f9585383815673b2420ee071ddffc2efeb7 /xlators | |
parent | 2208ed44a689b95bf236e6e492aa85f9bbb549a5 (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.
BUG: 1256669
Change-Id: I6eba385b50b3bdc86bc8f4ef295a004b3b87b68a
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>
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/12010
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-scrub.c | 24 | ||||
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot.h | 3 |
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 25bf884fd93..a311e2e6da8 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -832,6 +832,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) { @@ -1187,6 +1190,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) @@ -1211,6 +1215,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; @@ -1248,6 +1255,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) @@ -1271,7 +1279,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: @@ -1299,10 +1311,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 6cafd8be9f3..ebf847665f6 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot.h @@ -142,6 +142,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; |