From ec58dfa35864d51550dddac7ab8a730271a3773c Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Wed, 21 Sep 2011 06:45:47 -0500 Subject: [PATCH] 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(-) create mode 100644 0104-RHBZ-737989-systemd-unit-fix.patch create mode 100644 0105-fix-oom-adj.patch 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 + #include + #include ++#include + + /* + * 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 -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 - 0.4.9-18 - Rebuilt for rpm bug #728707