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
This commit is contained in:
Benjamin Marzinski 2011-09-21 06:45:47 -05:00
parent 2d21294f17
commit ec58dfa358
4 changed files with 115 additions and 3 deletions

View File

@ -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;

View File

@ -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]

69
0105-fix-oom-adj.patch Normal file
View File

@ -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)

View File

@ -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@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@gmail.com> - 0.4.9-18
- Rebuilt for rpm bug #728707