From 294a0ae90de88a28baeec3f5ab6f35f20521adba Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Tue, 25 Sep 2018 22:02:14 +0200 Subject: [PATCH] Fix future scrub times --- HISTORY | 3 ++- cmdline/state.c | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/HISTORY b/HISTORY index 20cf4ba5..1aa6803b 100644 --- a/HISTORY +++ b/HISTORY @@ -1,13 +1,14 @@ SnapRAID HISTORY ================ -11.3 2018/06 (WIP) +11.3 2018/09 (WIP) ================== * Fixed handing of Linux devices that have multiple slaves. This affects the smart/list/devices/down commands [Valentin Hilbig]. * The 'list' command in verbose mode prints the full nanosecond timestamp precision. * After writing content files also sync their directory. + * Fix a invalid time computation that could result in future scrub times. 11.2 2017/12 ============ diff --git a/cmdline/state.c b/cmdline/state.c index 26477bcd..e730c220 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -3278,7 +3278,12 @@ static void* state_write_thread(void* arg) flag |= 8; sputb32(flag, f); - t = info_get_time(info) - info_oldest; + /* the oldest info is computed only on required blocks, so it may not be the absolute oldest */ + if (info_get_time(info) >= info_oldest) + t = info_get_time(info) - info_oldest; + else + t = 0; + sputb32(t, f); } else { /* write a special 0 flag to mark missing info */