[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH] Avoid recursive calls from dmeventd to itself



Hi,

the attached patch keeps the LVM-based dmeventd plugins from trying to
manipulate the dmeventd monitoring state of the logical volumes they are
currently acting on.

Until now, every time a logical volume has been changed by a dmeventd
plugin, this plugin would have called back to dmeventd through the
external FIFO mechanism. I am fairly sure this is superfluous,
inefficient and possibly even dangerous.

It is probably related to RHBZ 707056 and I wouldn't be surprised if
this sometimes caused mirror repair issues. With the patch, the
incidence of "No longer monitoring..." messages while repairing mirrors
drops dramatically.

Yours,
   Petr

Index: daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c
===================================================================
RCS file: /cvs/lvm2/LVM2/daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c,v
retrieving revision 1.5
diff -u -p -r1.5 dmeventd_lvm.c
--- daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c	30 Sep 2010 11:40:14 -0000	1.5
+++ daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c	1 Sep 2011 01:01:52 -0000
@@ -114,7 +114,7 @@ int dmeventd_lvm2_init(void)
 			goto out;
 		}
 		/* FIXME Temporary: move to dmeventd core */
-		lvm2_run(_lvm_handle, "_memlock_inc");
+		lvm2_run(_lvm_handle, "_dmeventd_enter");
 	}
 
 	_register_count++;
@@ -130,7 +130,7 @@ void dmeventd_lvm2_exit(void)
 	pthread_mutex_lock(&_register_mutex);
 
 	if (!--_register_count) {
-		lvm2_run(_lvm_handle, "_memlock_dec");
+		lvm2_run(_lvm_handle, "_dmeventd_leave");
 		dm_pool_destroy(_mem_pool);
 		_mem_pool = NULL;
 		lvm2_exit(_lvm_handle);
Index: tools/lvmcmdlib.c
===================================================================
RCS file: /cvs/lvm2/LVM2/tools/lvmcmdlib.c,v
retrieving revision 1.12
diff -u -p -r1.12 lvmcmdlib.c
--- tools/lvmcmdlib.c	5 Mar 2010 14:48:34 -0000	1.12
+++ tools/lvmcmdlib.c	1 Sep 2011 01:01:52 -0000
@@ -81,9 +81,12 @@ int lvm2_run(void *handle, const char *c
 
 	/* FIXME Temporary - move to libdevmapper */
 	ret = ECMD_PROCESSED;
-	if (!strcmp(cmdline, "_memlock_inc"))
+	if (!strcmp(cmdline, "_dmeventd_enter")) {
 		memlock_inc_daemon(cmd);
-	else if (!strcmp(cmdline, "_memlock_dec"))
+                init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE);
+	} else if (!strcmp(cmdline, "_memlock_inc"))
+		memlock_inc_daemon(cmd);
+	else if (!strcmp(cmdline, "_memlock_dec") || !strcmp(cmdline, "_dmeventd_leave"))
 		memlock_dec_daemon(cmd);
 	else
 		ret = lvm_run_command(cmd, argc, argv);

-- 
id' Ash = Ash; id' Dust = Dust; id' _ = undefined

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]