[device-mapper-multipath] Modify 0103-add-disable-sync-option.patch Add 0104-RHBZ-737989-systemd-unit-fix.patch * systemd wil

Benjamin Marzinski bmarzins at fedoraproject.org
Wed Sep 21 17:38:02 UTC 2011


commit ec58dfa35864d51550dddac7ab8a730271a3773c
Author: Benjamin Marzinski <bmarzins at redhat.com>
Date:   Wed Sep 21 06:45:47 2011 -0500

    Modify 0103-add-disable-sync-option.patch
    Add 0104-RHBZ-737989-systemd-unit-fix.patch
     * systemd will only start multipathd if /etc/multipath.conf exists
    Add 0105-fix-oom-adj.patch
     * first try setting oom_score_adj

 0103-add-disable-sync-option.patch      |   13 +++++-
 0104-RHBZ-737989-systemd-unit-fix.patch |   23 ++++++++++
 0105-fix-oom-adj.patch                  |   69 +++++++++++++++++++++++++++++++
 device-mapper-multipath.spec            |   13 +++++-
 4 files changed, 115 insertions(+), 3 deletions(-)
---
diff --git a/0103-add-disable-sync-option.patch b/0103-add-disable-sync-option.patch
index 226dc06..864760a 100644
--- a/0103-add-disable-sync-option.patch
+++ b/0103-add-disable-sync-option.patch
@@ -1,6 +1,6 @@
 ---
- multipath/main.c |    4 ++++
- 1 file changed, 4 insertions(+)
+ multipath/main.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
 
 Index: multipath-tools/multipath/main.c
 ===================================================================
@@ -14,6 +14,15 @@ Index: multipath-tools/multipath/main.c
  		"  -b fil  bindings file location\n" \
  		"  -p pol  force all maps to specified path grouping policy :\n" \
  		"          . failover            one path per priority group\n" \
+@@ -383,7 +384,7 @@ main (int argc, char *argv[])
+ 		condlog(0, "multipath tools need sysfs mounted");
+ 		exit(1);
+ 	}
+-	while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brqu")) != EOF ) {
++	while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brqun")) != EOF ) {
+ 		switch(arg) {
+ 		case 1: printf("optarg : %s\n",optarg);
+ 			break;
 @@ -442,6 +443,9 @@ main (int argc, char *argv[])
  		case 'u':
  			conf->force_udev_rules = 1;
diff --git a/0104-RHBZ-737989-systemd-unit-fix.patch b/0104-RHBZ-737989-systemd-unit-fix.patch
new file mode 100644
index 0000000..d24d58d
--- /dev/null
+++ b/0104-RHBZ-737989-systemd-unit-fix.patch
@@ -0,0 +1,23 @@
+---
+ multipathd/multipathd.service |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+Index: multipath-tools/multipathd/multipathd.service
+===================================================================
+--- multipath-tools.orig/multipathd/multipathd.service
++++ multipath-tools/multipathd/multipathd.service
+@@ -2,12 +2,13 @@
+ Description=Device-Mapper Multipath Device Controller
+ Before=iscsi.service iscsid.service
+ After=syslog.target
++ConditionPathExists=/etc/multipath.conf
+ 
+ [Service]
+ Type=forking
+ PIDFile=/var/run/multipathd.pid
+ ExecStart=/sbin/multipathd
+-ExecReload=/bin/kill -HUP $MAINPID
++ExecReload=/sbin/multipathd reconfigure
+ #ExecStop=/path/to/scrip delete-me if not necessary
+ 
+ [Install]
diff --git a/0105-fix-oom-adj.patch b/0105-fix-oom-adj.patch
new file mode 100644
index 0000000..a51c09c
--- /dev/null
+++ b/0105-fix-oom-adj.patch
@@ -0,0 +1,69 @@
+---
+ multipathd/main.c |   37 ++++++++++++++++++++++++++++---------
+ 1 file changed, 28 insertions(+), 9 deletions(-)
+
+Index: multipath-tools/multipathd/main.c
+===================================================================
+--- multipath-tools.orig/multipathd/main.c
++++ multipath-tools/multipathd/main.c
+@@ -15,6 +15,7 @@
+ #include <sys/time.h>
+ #include <sys/resource.h>
+ #include <limits.h>
++#include <linux/oom.h>
+ 
+ /*
+  * libcheckers
+@@ -1389,17 +1390,35 @@ setscheduler (void)
+ }
+ 
+ static void
+-set_oom_adj (int val)
++set_oom_adj (void)
+ {
++	int retry = 1;
++	char *file = "/proc/self/oom_score_adj";
++	int score = OOM_SCORE_ADJ_MIN;
+ 	FILE *fp;
++	struct stat st;
+ 
+-	fp = fopen("/proc/self/oom_adj", "w");
+-
+-	if (!fp)
+-		return;
+-
+-	fprintf(fp, "%i", val);
+-	fclose(fp);
++	do {
++		if (stat(file, &st) == 0){
++			fp = fopen(file, "w");
++			if (!fp) {
++				condlog(0, "couldn't fopen %s : %s", file,
++					strerror(errno));
++				return;
++			}
++			fprintf(fp, "%i", score);
++			fclose(fp);
++			return;
++		}
++		if (errno != ENOENT) {
++			condlog(0, "couldn't stat %s : %s", file,
++				strerror(errno));
++			return;
++		}
++		file = "/proc/self/oom_adj";
++		score = OOM_ADJUST_MIN;
++	} while (retry--);
++	condlog(0, "couldn't adjust oom score");
+ }
+ 
+ void
+@@ -1489,7 +1508,7 @@ child (void * param)
+ 	}
+ 	signal_init();
+ 	setscheduler();
+-	set_oom_adj(-16);
++	set_oom_adj();
+ 	vecs = gvecs = init_vecs();
+ 
+ 	if (!vecs)
diff --git a/device-mapper-multipath.spec b/device-mapper-multipath.spec
index 8233bd4..fb562a5 100644
--- a/device-mapper-multipath.spec
+++ b/device-mapper-multipath.spec
@@ -1,7 +1,7 @@
 Summary: Tools to manage multipath devices using device-mapper
 Name: device-mapper-multipath
 Version: 0.4.9
-Release: 18%{?dist}
+Release: 19%{?dist}
 License: GPL+
 Group: System Environment/Base
 URL: http://christophe.varoqui.free.fr/
@@ -115,6 +115,8 @@ Patch1100: 0100-RHBZ-710478-deprecate-uid-gid-mode.patch
 Patch1101: 0101-RHBZ-631009-disable-udev-disk-rules-on-reload.patch
 Patch1102: 0102-RHBZ-690828-systemd-unit-file.patch
 Patch1103: 0103-add-disable-sync-option.patch
+Patch1104: 0104-RHBZ-737989-systemd-unit-fix.patch
+Patch1105: 0105-fix-oom-adj.patch
 
 # runtime
 Requires: %{name}-libs = %{version}-%{release}
@@ -272,6 +274,8 @@ kpartx manages partition creation and removal for device-mapper devices.
 %patch1101 -p1
 %patch1102 -p1
 %patch1103 -p1
+%patch1104 -p1
+%patch1105 -p1
 cp %{SOURCE1} .
 
 %build
@@ -361,6 +365,13 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||:
 %{_mandir}/man8/kpartx.8.gz
 
 %changelog
+* Tue Sep 20 2011 Benjamin Marzinski <bmarzins at redhat.com> -0.4.9-19
+  - Modify 0103-add-disable-sync-option.patch
+  - Add 0104-RHBZ-737989-systemd-unit-fix.patch
+    * systemd will only start multipathd if /etc/multipath.conf exists
+  - Add 0105-fix-oom-adj.patch
+    * first try setting oom_score_adj
+
 * Mon Aug 15 2011 Kalev Lember <kalevlember at gmail.com> - 0.4.9-18
 - Rebuilt for rpm bug #728707
 


More information about the scm-commits mailing list