From f7dac49b41df49897b8555b922129bf7f76f60d8 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Thu, 15 Jun 2017 08:31:06 -0400 Subject: [PATCH 518/525] feature/bitrot: Fix ondemand scrub The flag which keeps tracks of whether the scrub frequency is changed from previous value should not be considered for on-demand scrubbing. It should be considered only for 'scrub-frequency' where it should not be re-scheduled if it is set to same value again. But in case ondemand scrub, it should start the scrub immediately no matter what the scrub-frequency. Reproducer: 1. Enable bitrot 2. Set scrub-throttle 3. Set ondemand scrub Make sure glusterd is not restarted while doing above steps > Change-Id: Ice5feaece7fff1579fb009d1a59d2b8292e23e0b > BUG: 1461845 > Signed-off-by: Kotresh HR > Reviewed-on: https://review.gluster.org/17552 > Smoke: Gluster Build System > CentOS-regression: Gluster Build System > Reviewed-by: Raghavendra Bhat > NetBSD-regression: NetBSD Build System Change-Id: Ice5feaece7fff1579fb009d1a59d2b8292e23e0b BUG: 1454596 Signed-off-by: Kotresh HR Reviewed-on: https://code.engineering.redhat.com/gerrit/109279 Reviewed-by: Atin Mukherjee --- xlators/features/bit-rot/src/bitd/bit-rot-scrub.c | 5 ----- xlators/features/bit-rot/src/bitd/bit-rot.c | 8 +++++++- 2 files changed, 7 insertions(+), 6 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 265fe60..8d25941 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -1049,16 +1049,11 @@ br_fsscan_ondemand (xlator_t *this) char timestr[1024] = {0,}; struct timeval now = {0,}; br_private_t *priv = NULL; - struct br_scrubber *fsscrub = NULL; struct br_monitor *scrub_monitor = NULL; priv = this->private; - fsscrub = &priv->fsscrub; scrub_monitor = &priv->scrub_monitor; - if (!fsscrub->frequency_reconf) - return 0; - (void) gettimeofday (&now, NULL); timo = BR_SCRUB_ONDEMAND; diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c index 6d60ca4..d88231b 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -1680,8 +1680,14 @@ notify (xlator_t *this, int32_t event, void *data, ...) gf_log (this->name, GF_LOG_INFO, "BitRot scrub ondemand " "called"); - if (scrub_monitor->state != BR_SCRUB_STATE_PENDING) + if (scrub_monitor->state != BR_SCRUB_STATE_PENDING) { + gf_msg (this->name, GF_LOG_ERROR, 0, + BRB_MSG_RESCHEDULE_SCRUBBER_FAILED, + "on demand scrub schedule failed. Scrubber is " + "not in pending state. Current state is %d", + scrub_monitor->state); return -2; + } /* Needs synchronization with reconfigure thread */ pthread_mutex_lock (&priv->lock); -- 1.8.3.1