From d047b34df20a1dbed3656a5d49c2a101ced2bb9c Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Tue, 8 Jan 2013 16:35:00 +0100 Subject: [PATCH] Fix code to make mdmon leave the udev cgroup correctly Signed-off-by: Jes Sorensen --- mdadm-3.2.6-cgroup.patch | 27 ++++++++++++++------------- mdadm.spec | 6 +++++- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/mdadm-3.2.6-cgroup.patch b/mdadm-3.2.6-cgroup.patch index 575fcc4..69638bd 100644 --- a/mdadm-3.2.6-cgroup.patch +++ b/mdadm-3.2.6-cgroup.patch @@ -1,8 +1,8 @@ diff -up mdadm-3.2.6/util.c.cgroup mdadm-3.2.6/util.c ---- mdadm-3.2.6/util.c.cgroup 2012-11-15 16:48:03.327035349 -0500 -+++ mdadm-3.2.6/util.c 2012-11-15 17:07:16.628751041 -0500 -@@ -1611,6 +1611,25 @@ int mdmon_running(int devnum) - return 0; +--- mdadm-3.2.6/mdmon.c.cgroup 2012-11-15 16:48:03.327035349 -0500 ++++ mdadm-3.2.6/mdmon.c 2012-11-15 17:07:16.628751041 -0500 +@@ -386,6 +386,25 @@ + return mdmon(devname, devnum, do_fork(), takeover); } +int set_cgroup(char *group) @@ -24,14 +24,15 @@ diff -up mdadm-3.2.6/util.c.cgroup mdadm-3.2.6/util.c + return 0; +} + - int start_mdmon(int devnum) + static int mdmon(char *devname, int devnum, int must_fork, int takeover) { - int i, skipped; -@@ -1653,6 +1668,7 @@ int start_mdmon(int devnum) + int mdfd; +@@ -438,6 +457,8 @@ + } else + pfd[0] = pfd[1] = -1; - for (i=0; paths[i]; i++) - if (paths[i][0]) { -+ set_cgroup("systemd"); - if (__offroot) { - execl(paths[i], "mdmon", "--offroot", - devnum2devname(devnum), ++ set_cgroup("systemd"); ++ + container = calloc(1, sizeof(*container)); + container->devnum = devnum; + container->devname = devname; diff --git a/mdadm.spec b/mdadm.spec index 10c2661..fd10d8c 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,7 +1,7 @@ Summary: The mdadm program controls Linux md devices (software RAID arrays) Name: mdadm Version: 3.2.6 -Release: 10%{?dist} +Release: 11%{?dist} Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz Source1: mdmonitor.init Source2: raid-check @@ -159,6 +159,10 @@ rm -rf %{buildroot} %endif %changelog +* Tue Jan 8 2013 Jes Sorensen - 3.2.6-11 +- Move code to leave udev cgroup into mdmon and excute it after we + work, to make sure it actually does the right thing. + * Mon Jan 7 2013 Jes Sorensen - 3.2.6-10 - Fix mdmonitor-takeover.service dangling symlink problem for real