diff --git a/mdadm-3.2.6-cgroup.patch b/mdadm-3.2.6-cgroup.patch new file mode 100644 index 0000000..76522cb --- /dev/null +++ b/mdadm-3.2.6-cgroup.patch @@ -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), diff --git a/mdadm.spec b/mdadm.spec index dff4712..7085cc8 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: 1%{?dist} +Release: 2%{?dist} Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz Source1: mdmonitor.init Source2: raid-check @@ -12,6 +12,7 @@ Source6: mdmonitor.service Source7: mdmonitor-takeover.service Source8: mdadm.conf Source9: mdadm_event.conf +Patch0: mdadm-3.2.6-cgroup.patch # Fedora customization patches Patch97: mdadm-3.2.6-udev.patch Patch98: mdadm-2.5.2-static.patch @@ -54,6 +55,7 @@ is not used as the system init process. %prep %setup -q +%patch0 -p1 -b .cgroup # Fedora customization patches %patch97 -p1 -b .udev @@ -135,6 +137,9 @@ rm -rf %{buildroot} %{_initrddir}/* %changelog +* Thu Nov 15 2012 Doug Ledford - 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 - 3.2.6-1 - Upgrade to mdadm-3.2.6