Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Aug 2010 14:06:00 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r211878 - head/sbin/hastd
Message-ID:  <201008271406.o7RE60Vf080042@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Fri Aug 27 14:06:00 2010
New Revision: 211878
URL: http://svn.freebsd.org/changeset/base/211878

Log:
  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

Modified:
  head/sbin/hastd/primary.c

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c	Fri Aug 27 14:01:28 2010	(r211877)
+++ head/sbin/hastd/primary.c	Fri Aug 27 14:06:00 2010	(r211878)
@@ -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, 
 	/*
 	 * 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008271406.o7RE60Vf080042>