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

[lvm-devel] [PATCHES] new patches for dmeventd



Hi

These are revised patches, in the previous patch I errorneously edited 
autogenerated file.

There is another problem with "System call interrupted" messages on 
ioctls. (note that much more code is vulnerable to this and signal 
handling needs to be checked --- SA_RESTART should be used).

Mikulas
Don't kill the parent process if we don't fork.

This makes dmeventd undebuggable (it kills gdb) and also can cause
various other script errors when run with -d from a script or some
other program (interactive shell catches SIGTERM, so the bug is not
visible with it).

Signed-off-by: Mikulas Patocka <mpatocka redhat com

---
 daemons/dmeventd/dmeventd.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: LVM2.2.02.48/daemons/dmeventd/dmeventd.c
===================================================================
--- LVM2.2.02.48.orig/daemons/dmeventd/dmeventd.c	2009-07-14 22:15:06.000000000 +0200
+++ LVM2.2.02.48/daemons/dmeventd/dmeventd.c	2009-07-14 22:27:59.000000000 +0200
@@ -1734,7 +1734,8 @@ int main(int argc, char *argv[])
 		exit(EXIT_FIFO_FAILURE);
 
 	/* Signal parent, letting them know we are ready to go. */
-	kill(getppid(), SIGTERM);
+	if (!_debug)
+		kill(getppid(), SIGTERM);
 	syslog(LOG_NOTICE, "dmeventd ready for processing.");
 
 	while (!_exit_now) {
Make dmeventd work when snapshot segtype library is compiled as a module.

Signed-off-by: Mikulas Patocka <mpatocka redhat com

---
 daemons/dmeventd/dmeventd.c |    2 +-
 tools/.exported_symbols     |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: LVM2.2.02.48/daemons/dmeventd/dmeventd.c
===================================================================
--- LVM2.2.02.48.orig/daemons/dmeventd/dmeventd.c	2009-07-15 01:59:15.000000000 +0200
+++ LVM2.2.02.48/daemons/dmeventd/dmeventd.c	2009-07-15 02:00:36.000000000 +0200
@@ -873,7 +873,7 @@ static struct dso_data *_load_dso(struct
 	void *dl;
 	struct dso_data *ret = NULL;
 
-	if (!(dl = dlopen(data->dso_name, RTLD_NOW))) {
+	if (!(dl = dlopen(data->dso_name, RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND))) {
 		const char *dlerr = dlerror();
 		syslog(LOG_ERR, "dmeventd %s dlopen failed: %s", data->dso_name,
 		       dlerr);
Index: LVM2.2.02.48/tools/.exported_symbols
===================================================================
--- LVM2.2.02.48.orig/tools/.exported_symbols	2009-07-15 02:05:59.000000000 +0200
+++ LVM2.2.02.48/tools/.exported_symbols	2009-07-15 02:06:02.000000000 +0200
@@ -5,3 +5,4 @@ lvm2_log_fn
 lvm2_exit
 find_config_tree_str
 print_log
+get_shared_library_path
---
 libdm/ioctl/libdm-iface.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

Index: LVM2.2.02.48/libdm/ioctl/libdm-iface.c
===================================================================
--- LVM2.2.02.48.orig/libdm/ioctl/libdm-iface.c	2009-07-15 01:46:18.000000000 +0200
+++ LVM2.2.02.48/libdm/ioctl/libdm-iface.c	2009-07-15 01:49:36.000000000 +0200
@@ -710,16 +710,21 @@ static int _dm_task_run_v1(struct dm_tas
 			goto bad;
 	} 
 #ifdef DM_IOCTLS
-	else if (ioctl(_control_fd, command, dmi) < 0) {
-		if (_log_suppress)
-			log_verbose("device-mapper: %s ioctl failed: %s", 
-				    _cmd_data_v1[dmt->type].name,
-				    strerror(errno));
-		else
-			log_error("device-mapper: %s ioctl failed: %s",
-				  _cmd_data_v1[dmt->type].name,
-				  strerror(errno));
-		goto bad;
+	else {
+		again:
+		if (ioctl(_control_fd, command, dmi) < 0) {
+			if (errno == EINTR)
+				goto again;
+			if (_log_suppress)
+				log_verbose("device-mapper: %s ioctl failed: %s",
+					    _cmd_data_v1[dmt->type].name,
+					    strerror(errno));
+			else
+				log_error("device-mapper: %s ioctl failed: %s",
+					  _cmd_data_v1[dmt->type].name,
+					  strerror(errno));
+			goto bad;
+		}
 	}
 #else /* Userspace alternative for testing */
 #endif

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