Try to resolve cgroup issue
Udev wants us to not start mdmon under its cgroup (it kills mdmon if we leave it in udev's cgroup), so as part of the mdmon startup process, set the child process to be part of the systemd cgroup instead. However, if we don't have cgroups, or there is no systemd cgroup, then just silently move on. Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
5fca48bd6d
commit
14c7631f2d
33
mdadm-3.2.6-cgroup.patch
Normal file
33
mdadm-3.2.6-cgroup.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
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,21 @@ int mdmon_running(int devnum)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void set_cgroup(char *group)
|
||||||
|
+{
|
||||||
|
+ char pid[8];
|
||||||
|
+ char pathbuf[PATH_MAX];
|
||||||
|
+ int tasks_fd;
|
||||||
|
+
|
||||||
|
+ snprintf(pathbuf, PATH_MAX, "/sys/fs/cgroup/%s/tasks", group);
|
||||||
|
+ tasks_fd = open(pathbuf, O_WRONLY);
|
||||||
|
+ if (tasks_fd >= 0) {
|
||||||
|
+ snprintf(pid, sizeof(pid), "%d", getpid());
|
||||||
|
+ write(tasks_fd, pid, strlen(pid));
|
||||||
|
+ close(tasks_fd);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int start_mdmon(int devnum)
|
||||||
|
{
|
||||||
|
int i, skipped;
|
||||||
|
@@ -1653,6 +1668,7 @@ int start_mdmon(int devnum)
|
||||||
|
|
||||||
|
for (i=0; paths[i]; i++)
|
||||||
|
if (paths[i][0]) {
|
||||||
|
+ set_cgroup("systemd");
|
||||||
|
if (__offroot) {
|
||||||
|
execl(paths[i], "mdmon", "--offroot",
|
||||||
|
devnum2devname(devnum),
|
@ -1,7 +1,7 @@
|
|||||||
Summary: The mdadm program controls Linux md devices (software RAID arrays)
|
Summary: The mdadm program controls Linux md devices (software RAID arrays)
|
||||||
Name: mdadm
|
Name: mdadm
|
||||||
Version: 3.2.6
|
Version: 3.2.6
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
|
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
|
||||||
Source1: mdmonitor.init
|
Source1: mdmonitor.init
|
||||||
Source2: raid-check
|
Source2: raid-check
|
||||||
@ -12,6 +12,7 @@ Source6: mdmonitor.service
|
|||||||
Source7: mdmonitor-takeover.service
|
Source7: mdmonitor-takeover.service
|
||||||
Source8: mdadm.conf
|
Source8: mdadm.conf
|
||||||
Source9: mdadm_event.conf
|
Source9: mdadm_event.conf
|
||||||
|
Patch0: mdadm-3.2.6-cgroup.patch
|
||||||
# Fedora customization patches
|
# Fedora customization patches
|
||||||
Patch97: mdadm-3.2.6-udev.patch
|
Patch97: mdadm-3.2.6-udev.patch
|
||||||
Patch98: mdadm-2.5.2-static.patch
|
Patch98: mdadm-2.5.2-static.patch
|
||||||
@ -54,6 +55,7 @@ is not used as the system init process.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch0 -p1 -b .cgroup
|
||||||
|
|
||||||
# Fedora customization patches
|
# Fedora customization patches
|
||||||
%patch97 -p1 -b .udev
|
%patch97 -p1 -b .udev
|
||||||
@ -135,6 +137,9 @@ rm -rf %{buildroot}
|
|||||||
%{_initrddir}/*
|
%{_initrddir}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 15 2012 Doug Ledford <dledford@redhat.com> - 3.2.6-2
|
||||||
|
- Modify mdadm to set the cgroup of mdmon to systemd if it's available
|
||||||
|
- Related bz873576 (and others)
|
||||||
|
|
||||||
* Thu Oct 25 2012 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.2.6-1
|
* Thu Oct 25 2012 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.2.6-1
|
||||||
- Upgrade to mdadm-3.2.6
|
- Upgrade to mdadm-3.2.6
|
||||||
|
Loading…
Reference in New Issue
Block a user