diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c index 2d8a0e484123..c495f1093bc0 100644 --- a/sbin/hastd/primary.c +++ b/sbin/hastd/primary.c @@ -1507,18 +1507,16 @@ sync_thread(void *arg __unused) ncomps = HAST_NCOMPONENTS; dorewind = true; - synced = -1; + synced = 0; + offset = -1; for (;;) { mtx_lock(&sync_lock); - if (synced == -1) - synced = 0; - else if (!sync_inprogress) { + if (offset >= 0 && !sync_inprogress) { pjdlog_info("Synchronization interrupted. " "%jd bytes synchronized so far.", (intmax_t)synced); - hook_exec(res->hr_exec, "syncintr", - res->hr_name, NULL); + hook_exec(res->hr_exec, "syncintr", res->hr_name, NULL); } while (!sync_inprogress) { dorewind = true;