svn commit: r211878 - head/sbin/hastd

Pawel Jakub Dawidek pjd at FreeBSD.org
Fri Aug 27 14:06:00 UTC 2010


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


More information about the svn-src-all mailing list