We have sync_start() function to start synchronization, introduce sync_stop()

function to stop it.

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
This commit is contained in:
Pawel Jakub Dawidek 2010-08-27 14:06:00 +00:00
parent 16bd7026a2
commit 55ce1e7c8b

View File

@ -685,6 +685,16 @@ sync_start(void)
cv_signal(&sync_cond);
}
static void
sync_stop(void)
{
mtx_lock(&sync_lock);
if (sync_inprogress)
sync_inprogress = false;
mtx_unlock(&sync_lock);
}
static void
init_ggate(struct hast_resource *res)
{
@ -871,10 +881,7 @@ remote_close(struct hast_resource *res, int ncomp)
/*
* Stop synchronization if in-progress.
*/
mtx_lock(&sync_lock);
if (sync_inprogress)
sync_inprogress = false;
mtx_unlock(&sync_lock);
sync_stop();
/*
* Wake up guard thread, so it can immediately start reconnect.
@ -1526,9 +1533,7 @@ sync_thread(void *arg __unused)
}
}
if (offset < 0) {
mtx_lock(&sync_lock);
sync_inprogress = false;
mtx_unlock(&sync_lock);
sync_stop();
pjdlog_debug(1, "Nothing to synchronize.");
/*
* Synchronization complete, make both localcnt and