diff options
Diffstat (limited to 'xlators/features/bit-rot/src/bitd')
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c | 6 | ||||
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-scrub.c | 13 | ||||
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot.c | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c index 0afd7ea05b1..2f9aaf31a52 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c @@ -55,9 +55,12 @@ void br_update_scrub_finish_time (br_scrub_stats_t *scrub_stat, char *timestr, struct timeval *tv) { + int lst_size = 0; + if (!scrub_stat) return; + lst_size = sizeof (scrub_stat->last_scrub_time); pthread_mutex_lock (&scrub_stat->lock); { scrub_stat->scrub_end_tv.tv_sec = tv->tv_sec; @@ -67,7 +70,8 @@ br_update_scrub_finish_time (br_scrub_stats_t *scrub_stat, char *timestr, scrub_stat->scrub_start_tv.tv_sec; strncpy (scrub_stat->last_scrub_time, timestr, - sizeof (scrub_stat->last_scrub_time)); + lst_size-1); + scrub_stat->last_scrub_time[lst_size-1] = '\0'; } pthread_mutex_unlock (&scrub_stat->lock); } 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 8812e99535a..0e706c92dff 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -1632,10 +1632,9 @@ br_read_bad_object_dir (xlator_t *this, br_child_t *child, fd_t *fd, NULL, NULL))) { if (ret < 0) goto out; - if (ret == 0) - break; - list_for_each_entry (entry, &entries.list, list) { - offset = entry->d_off; + + list_for_each_entry (entry, &entries.list, list) { + offset = entry->d_off; snprintf (key, sizeof (key), "quarantine-%d", count); @@ -1648,10 +1647,10 @@ br_read_bad_object_dir (xlator_t *this, br_child_t *child, fd_t *fd, entry->d_name); if (!ret) count++; - } + } - gf_dirent_free (&entries); - } + gf_dirent_free (&entries); + } ret = count; ret = dict_set_int32 (dict, "count", count); diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c index c5b4037ee98..04ccc013cda 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -1988,7 +1988,7 @@ init (xlator_t *this) goto out; } - GF_OPTION_INIT ("scrubber", priv->iamscrubber, bool, out); + GF_OPTION_INIT ("scrubber", priv->iamscrubber, bool, free_priv); ret = br_init_children (this, priv); if (ret) |