From f2098b61d732089bd5d831a631fdbda542855f1f Mon Sep 17 00:00:00 2001 From: Doug Ledford Date: Wed, 7 Apr 2010 14:51:17 +0000 Subject: [PATCH] - Fix up directory in mdmonitor init script so that we restart mdmon like we are supposed to - Add a rule to run incremental assembly on containers in case there are multiple volumes in a container and we only started some of them in the initramfs - Make -If work with imsm arrays. We had too restrictive of a test in sysfs_unique_holder. --- mdadm-3.1.2-decremental-3.patch | 35 +++++++++++++++++++++++++++++++++ mdadm.rules | 14 +++++++++++-- mdadm.spec | 13 +++++++++++- mdmonitor.init | 13 +++++++----- 4 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 mdadm-3.1.2-decremental-3.patch diff --git a/mdadm-3.1.2-decremental-3.patch b/mdadm-3.1.2-decremental-3.patch new file mode 100644 index 0000000..0716d63 --- /dev/null +++ b/mdadm-3.1.2-decremental-3.patch @@ -0,0 +1,35 @@ +commit 1934c67fe5bc25a79393ad78e29bf9ef778bc701 +Author: Doug Ledford +Date: Tue Apr 6 23:02:47 2010 -0400 + + Only close lfd if we have an external metadata type since that's the only + time we'll have it open. + + If we weren't able to open the device file, assume the device is gone + already and skip the sysfs_unique_holder test as it is guaranteed to + fail. + + Signed-off-by: Doug Ledford + +diff --git a/Manage.c b/Manage.c +index b15586b..a690cfc 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -811,6 +811,7 @@ int Manage_subdevs(char *devname, int fd, + * rely on the 'detached' checks + */ + if (strcmp(dv->devname, "detached") == 0 || ++ tfd < 0 || + sysfs_unique_holder(dnum, stb.st_rdev)) + /* pass */; + else { +@@ -878,8 +879,8 @@ int Manage_subdevs(char *devname, int fd, + + ping_manager(name); + free(name); ++ close(lfd); + } +- close(lfd); + if (verbose >= 0) + fprintf(stderr, Name ": hot removed %s\n", + dnprintable); diff --git a/mdadm.rules b/mdadm.rules index ac16519..85f9dfc 100644 --- a/mdadm.rules +++ b/mdadm.rules @@ -3,13 +3,23 @@ # See udev(8) for syntax SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \ - RUN+="/sbin/mdadm -I $env{DEVNAME}" + RUN+="/sbin/mdadm -I $tempnode" SUBSYSTEM=="block", ACTION=="remove", ENV{ID_FS_TYPE}=="linux_raid_member", \ RUN+="/sbin/mdadm -If $env{DEVNAME}" ENV{rd_NO_MDIMSM}=="?*", GOTO="md_imsm_inc_end" +# In case the initramfs only started some of the arrays in our container, +# run incremental assembly on the container itself. Note: we ran mdadm +# on the container in 64-md-raid.rules, and that's how the MD_LEVEL +# environment variable is already set. If that disappears from the other +# file, we will need to add this line into the middle of the next rule: +# IMPORT{program}="/sbin/mdadm -D --export $tempnode", \ + +SUBSYSTEM=="block", ACTION=="add|change", KERNEL=="md*", \ + ENV{MD_LEVEL}=="container", RUN+="/sbin/mdadm -I $tempnode" + SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="isw_raid_member", \ - RUN+="/sbin/mdadm -I $env{DEVNAME}" + RUN+="/sbin/mdadm -I $tempnode" SUBSYSTEM=="block", ACTION=="remove", ENV{ID_FS_TYPE}=="isw_raid_member", \ RUN+="/sbin/mdadm -If $env{DEVNAME}" LABEL="md_imsm_inc_end" diff --git a/mdadm.spec b/mdadm.spec index 4b8a512..cdd9740 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.1.2 -Release: 6%{?dist} +Release: 7%{?dist} Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.bz2 Source1: mdmonitor.init Source2: raid-check @@ -14,6 +14,7 @@ Patch4: mdadm-3.1.2-rebuild.patch Patch5: mdadm-3.1.2-directory.patch Patch6: mdadm-3.1.2-decremental.patch Patch7: mdadm-3.1.2-decremental-2.patch +Patch10: mdadm-3.1.2-decremental-3.patch Patch8: mdadm-3.1.2-powerpc-compile.patch Patch9: mdadm-2.5.2-static.patch URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ @@ -43,6 +44,7 @@ file can be used to help with some common tasks. %patch5 -p1 -b .directory %patch6 -p1 -b .decremental %patch7 -p1 -b .decremental-2 +%patch10 -p1 -b .decremental-3 %patch8 -p1 -b .powerpc %patch9 -p1 -b .static @@ -91,6 +93,15 @@ fi %attr(0700,root,root) %dir /var/run/mdadm %changelog +* Tue Apr 06 2010 Doug Ledford - 3.1.2-7 +- Fix up directory in mdmonitor init script so that we restart mdmon like we + are supposed to +- Add a rule to run incremental assembly on containers in case there are + multiple volumes in a container and we only started some of them in the + initramfs +- Make -If work with imsm arrays. We had too restrictive of a test in + sysfs_unique_holder. + * Tue Apr 06 2010 Doug Ledford - 3.1.2-6 - Typo in new rules file diff --git a/mdmonitor.init b/mdmonitor.init index 1be12c9..cb2cfed 100755 --- a/mdmonitor.init +++ b/mdmonitor.init @@ -41,11 +41,14 @@ usage () start () { # (Re)start mdmon to take over monitoring of mdmon started from the initrd - if [ -f /dev/md/*.pid ]; then - origprog="$prog"; prog="mdmon" - action $"Starting $prog: " /sbin/mdmon --takeover --all - prog="$origprog" - fi + for i in /dev/md/*.pid; do + if [ -r $i ]; then + origprog="$prog"; prog="mdmon" + action $"Starting $prog: " /sbin/mdmon --takeover --all + prog="$origprog" + break + fi + done # Make sure configuration file exists and has information we can use # MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor [ -f /etc/mdadm.conf ] || return 6