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

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



Petr Rockai <prockai redhat com> writes:

>> It might be a little more code, but I'd rather see it a property of the handle
>> never to perform dmeventd monitoring calls.  We never fixed handle init to 
>> take multiple settings, so maybe call
>>   void lvm2_disable_dmeventd_monitoring(void *handle)
>> after handle initialisation to set DMEVENTD_MONITOR_DISABLED and have that take
>> precedence over any later attempt to enable monitoring.
>
> This sounds like a better option. Now that raises the question why we
> aren't doing the same thing for memlock_{inc,dec}? We should certainly
> unify these two things. I'll have a look, and unless I run into a
> stumbling block will submit a patch to do that.

The patch doing that is attached. Seems straightforward enough to me. We
can change the memlock interface to be the same, too.

Yours,
   Petr

Index: tools/lvm2cmd.h
===================================================================
RCS file: /cvs/lvm2/LVM2/tools/lvm2cmd.h,v
retrieving revision 1.5
diff -u -p -r1.5 lvm2cmd.h
--- tools/lvm2cmd.h	16 Jun 2010 13:01:25 -0000	1.5
+++ tools/lvm2cmd.h	10 Oct 2011 14:30:38 -0000
@@ -52,6 +52,12 @@ void lvm2_log_fn(lvm2_log_fn_t log_fn);
 void *lvm2_init(void);
 
 /*
+ * Disable any dmeventd calls that the library may otherwise do. Useful to avoid
+ * recursive calls from dmeventd to itself.
+ */
+void lvm2_disable_dmeventd_monitoring(void *handle);
+
+/*
  * Set log level (as above) if using built-in logging function. 
  * Default is LVM2_LOG_PRINT.  Use LVM2_LOG_SUPPRESS to suppress output.
  */
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	10 Oct 2011 14:30:38 -0000
@@ -97,6 +97,10 @@ int lvm2_run(void *handle, const char *c
 	return ret;
 }
 
+void lvm2_disable_dmeventd_monitoring(void *handle) {
+	init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE);
+}
+
 void lvm2_log_level(void *handle, int level)
 {
 	struct cmd_context *cmd = (struct cmd_context *) handle;
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	10 Oct 2011 14:30:38 -0000
@@ -113,6 +113,7 @@ int dmeventd_lvm2_init(void)
 			_mem_pool = NULL;
 			goto out;
 		}
+		lvm2_disable_dmeventd_monitoring(_lvm_handle);
 		/* FIXME Temporary: move to dmeventd core */
 		lvm2_run(_lvm_handle, "_memlock_inc");
 	}
-- 
id' Ash = Ash; id' Dust = Dust; id' _ = undefined

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