This is the mail archive of the lvm2-cvs@sourceware.org mailing list for the LVM2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

LVM2 ./WHATS_NEW dmeventd/mirror/dmeventd_mirror.c


CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-07-04 18:57:27

Modified files:
	.              : WHATS_NEW 
	dmeventd/mirror: dmeventd_mirror.c 

Log message:
	Add mutex to dmeventd_mirror to avoid concurrent execution.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.404&r2=1.405
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/dmeventd/mirror/dmeventd_mirror.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7

--- LVM2/WHATS_NEW	2006/06/14 20:27:15	1.404
+++ LVM2/WHATS_NEW	2006/07/04 18:57:26	1.405
@@ -1,5 +1,7 @@
 Version 2.02.07 - 
 =================================
+  Add mutex to dmeventd_mirror to avoid concurrent execution.
+  Fix vgreduce --removemissing to return success if VG is already consistent.
   Fix return code if VG specified on command line is not found.
   Fix PV tools to include orphaned PVs in default output again.
   Fixed unaligned access when using clvm.
--- LVM2/dmeventd/mirror/dmeventd_mirror.c	2006/05/11 19:45:53	1.6
+++ LVM2/dmeventd/mirror/dmeventd_mirror.c	2006/07/04 18:57:27	1.7
@@ -31,6 +31,8 @@
 #define ME_INSYNC    1
 #define ME_FAILURE   2
 
+static pthread_mutex_t _lock = PTHREAD_MUTEX_INITIALIZER;
+
 /* FIXME: We may need to lock around operations to these */
 static int register_count = 0;
 static struct dm_pool *mem_pool = NULL;
@@ -150,6 +152,10 @@
 	char *target_type = NULL;
 	char *params;
 
+	if (pthread_mutex_trylock(&_lock)) {
+		syslog(LOG_NOTICE, "Another thread is handling an event.  Waiting...");
+		pthread_mutex_lock(&_lock);
+	}
 	/* FIXME Move inside libdevmapper */
 	if (!(dmt = dm_task_create(DM_DEVICE_STATUS))) {
 		syslog(LOG_ERR, "Unable to create dm_task.\n");
@@ -204,6 +210,7 @@
  fail:
 	if (dmt)
 		dm_task_destroy(dmt);
+	pthread_mutex_unlock(&_lock);
 }
 
 int register_device(const char *device)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]