summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2010-08-27 14:06:00 +0000
committerpjd <pjd@FreeBSD.org>2010-08-27 14:06:00 +0000
commitb51d684000e6dd62197115ac6a50e4fb37f3925e (patch)
tree0976f03b7dda7c0268d8e43bce6b19dc2718bad7 /sbin
parent79f0171a3ec5ef0e984f4e23c8f6bce66c34cd9b (diff)
downloadFreeBSD-src-b51d684000e6dd62197115ac6a50e4fb37f3925e.zip
FreeBSD-src-b51d684000e6dd62197115ac6a50e4fb37f3925e.tar.gz
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
Diffstat (limited to 'sbin')
-rw-r--r--sbin/hastd/primary.c19
1 files changed, 12 insertions, 7 deletions
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
OpenPOWER on IntegriCloud