From b51d684000e6dd62197115ac6a50e4fb37f3925e Mon Sep 17 00:00:00 2001 From: pjd Date: Fri, 27 Aug 2010 14:06:00 +0000 Subject: 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 --- sbin/hastd/primary.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'sbin/hastd/primary.c') diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c index a5e5d6e..1b08585 100644 --- a/sbin/hastd/primary.c +++ b/sbin/hastd/primary.c @@ -686,6 +686,16 @@ sync_start(void) } 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) { struct g_gate_ctl_create ggiocreate; @@ -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 -- cgit v1.1