From a2b3d7f053dca3c2c712cc531fa10afd39184917 Mon Sep 17 00:00:00 2001 From: Doug Ledford Date: Apr 08 2010 17:09:28 +0000 Subject: - 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. - Make incremental assembly of containers act like incremental assembly of regular devices (aka, --run is needed to start a degraded array) --- diff --git a/mdadm-3.1.2-container.patch b/mdadm-3.1.2-container.patch new file mode 100644 index 0000000..926e265 --- /dev/null +++ b/mdadm-3.1.2-container.patch @@ -0,0 +1,95 @@ +commit 3f45610e6b9e2419f09f7f1b415170b6128d91ad +Author: Doug Ledford +Date: Thu Apr 8 12:39:03 2010 -0400 + + Make Incremental container assembly behave like native array assembly + + Signed-off-by: Doug Ledford :4000 + +diff --git a/Assemble.c b/Assemble.c +index 1504f1f..d059155 100644 +--- a/Assemble.c ++++ b/Assemble.c +@@ -1327,8 +1327,10 @@ int assemble_container_content(struct supertype *st, int mdfd, + content->text_version, + content->uuid, chosen_name); + +- if (runstop > 0 || +- (working + preexist) >= content->array.working_disks) { ++ if ((runstop > 0 && ++ (working + preexist) >= content->array.working_disks) || ++ (runstop == 0 && ++ (working + preexist) == content->array.raid_disks)) { + int err; + + switch(content->array.level) { +diff --git a/Incremental.c b/Incremental.c +index d32a8e5..2a2df82 100644 +--- a/Incremental.c ++++ b/Incremental.c +@@ -424,20 +424,21 @@ int Incremental(char *devname, int verbose, int runstop, + sysfs_uevent(&info, "change"); + if (verbose >= 0) + fprintf(stderr, Name +- ": container %s now has %d devices\n", +- chosen_name, info.array.working_disks); ++ ": container %s now has %d out of %d devices\n", ++ chosen_name, info.array.working_disks, ++ info.array.raid_disks); + wait_for(chosen_name, mdfd); + close(mdfd); +- if (runstop < 0) +- return 0; /* don't try to assemble */ +- rv = Incremental(chosen_name, verbose, runstop, +- NULL, homehost, require_homehost, autof); +- if (rv == 1) +- /* Don't fail the whole -I if a subarray didn't +- * have enough devices to start yet ++ if (runstop == 1 || ++ info.array.working_disks == info.array.raid_disks) ++ /* The return value of our container assembly doesn't ++ * depend on whether or not subarrays assembled ++ * properly, so no need to preserve the return value ++ * here. + */ +- rv = 0; +- return rv; ++ Incremental(chosen_name, verbose, runstop, NULL, ++ homehost, require_homehost, autof); ++ return 0; + } + avail = NULL; + active_disks = count_active(st, mdfd, &avail, &info); +diff --git a/super-intel.c b/super-intel.c +index 999b970..7bcfcdb 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -1536,12 +1536,27 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info) + if (super->current_vol >= 0) { + getinfo_super_imsm_volume(st, info); + return; ++ } else { ++ struct mdinfo vol_info; ++ ++ super->current_vol = 0; ++ getinfo_super_imsm_volume(st, &vol_info); ++ super->current_vol = -1; ++ info->array.raid_disks = vol_info.array.raid_disks; + } + + /* Set raid_disks to zero so that Assemble will always pull in valid + * spares +- */ ++ * ++ * Note: my testing with assemble shows that it still works even ++ * when we set the raid_disks to a proper setting. However, without ++ * this it is impossible to tell when a container has the right ++ * number of disks to start cleanly without violating layering ++ * boundaries. So, not violating layering boundaries trumps spare ++ * disk issues. Doug Ledford ++ * + info->array.raid_disks = 0; ++ */ + info->array.level = LEVEL_CONTAINER; + info->array.layout = 0; + info->array.md_minor = -1; 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-3.1.2-powerpc-compile.patch b/mdadm-3.1.2-powerpc-compile.patch new file mode 100644 index 0000000..3dec0d1 --- /dev/null +++ b/mdadm-3.1.2-powerpc-compile.patch @@ -0,0 +1,21 @@ +commit 995511f26e8d661d32d1c3fc42a08960989d1e6d +Author: Doug Ledford +Date: Tue Apr 6 14:04:30 2010 -0400 + + powerpc compile fix + + Signed-off-by: Doug Ledford + +diff --git a/super-intel.c b/super-intel.c +index a196ca3..999b970 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -697,7 +697,7 @@ static void print_imsm_dev(struct imsm_dev *dev, char *uuid, int disk_idx) + printf(" <-- %s", map_state_str[map->map_state]); + printf("\n Checkpoint : %u (%llu)", + __le32_to_cpu(dev->vol.curr_migr_unit), +- blocks_per_migr_unit(dev)); ++ (unsigned long long)blocks_per_migr_unit(dev)); + } + printf("\n"); + printf(" Dirty State : %s\n", dev->vol.dirty ? "dirty" : "clean"); diff --git a/mdadm.rules b/mdadm.rules index df3d906..396b342 100644 --- a/mdadm.rules +++ b/mdadm.rules @@ -3,7 +3,24 @@ # 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", 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 $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 66f9412..4beb590 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: 3%{?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,7 +14,10 @@ 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 -Patch9: mdadm-2.5.2-static.patch +Patch8: mdadm-3.1.2-decremental-3.patch +Patch9: mdadm-3.1.2-powerpc-compile.patch +Patch10: mdadm-3.1.2-container.patch +Patch20: mdadm-2.5.2-static.patch URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ License: GPLv2+ Group: System Environment/Base @@ -42,7 +45,10 @@ file can be used to help with some common tasks. %patch5 -p1 -b .directory %patch6 -p1 -b .decremental %patch7 -p1 -b .decremental-2 -%patch9 -p1 -b .static +%patch8 -p1 -b .decremental-3 +%patch9 -p1 -b .powerpc +%patch10 -p1 -b .contrainer +%patch20 -p1 -b .static %build make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" SYSCONFDIR="%{_sysconfdir}" mdadm.static mdadm mdmon @@ -89,6 +95,26 @@ 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. +- Make incremental assembly of containers act like incremental assembly of + regular devices (aka, --run is needed to start a degraded array) + +* Tue Apr 06 2010 Doug Ledford - 3.1.2-6 +- Typo in new rules file + +* Tue Apr 06 2010 Doug Ledford - 3.1.2-5 +- Enable incremental support for imsm devices + +* Tue Apr 06 2010 Doug Ledford - 3.1.2-4 +- One line fix for ppc64 compiles + * Tue Apr 06 2010 Doug Ledford - 3.1.2-3 - Clean up directory mess once and for all - Add incremental remove support diff --git a/mdmonitor.init b/mdmonitor.init index d7b68fb..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/.mdadm/*.pid ]; then - origprog="$prog"; prog="mdmon" - action $"Starting $prog: " /sbin/mdmon /proc/mdstat / - 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