Fix code to make mdmon leave the udev cgroup correctly

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
This commit is contained in:
Jes Sorensen 2013-01-08 16:35:00 +01:00
parent 4335bd6f0f
commit d047b34df2
2 changed files with 19 additions and 14 deletions

View File

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

View File

@ -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 <Jes.Sorensen@redhat.com> - 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 <Jes.Sorensen@redhat.com> - 3.2.6-10
- Fix mdmonitor-takeover.service dangling symlink problem for real