diff --git a/manage-rebuild-map-for-kpartx b/manage-rebuild-map-for-kpartx new file mode 100644 index 0000000..eeae570 --- /dev/null +++ b/manage-rebuild-map-for-kpartx @@ -0,0 +1,43 @@ +Manage: rebuild map for 'kpartx -d' at stop + +From: Dan Williams + +mdadm needs the 'map' file to run 'kpartx -d' at array shutdown. +Rebuild it if it does not exist. + +Signed-off-by: Dan Williams +--- + + Manage.c | 14 +++++++++++++- + 1 files changed, 13 insertions(+), 1 deletions(-) + + +diff --git a/Manage.c b/Manage.c +index 85bb2c8..603e838 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -222,11 +222,23 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet) + mdi->array.level > 0 && + is_subarray(mdi->text_version)) { + struct map_ent *me = map_by_devnum(&map, devnum); ++ ++ if (!me) { ++ RebuildMap(); ++ me = map_by_devnum(&map, devnum); ++ } ++ ++ if (!me) { ++ fprintf(stderr, Name ": failed to map device %d\n", ++ devnum); ++ return 1; ++ } else ++ run_kpartx('d', me->path); ++ + /* This is mdmon managed. */ + close(fd); + + /* Delete any kpartx partitions */ +- run_kpartx('d', me->path); + if (sysfs_set_str(mdi, NULL, + "array_state", "inactive") < 0) { + if (quiet == 0) diff --git a/mdadm.changes b/mdadm.changes index 0c18972..c7031fa 100644 --- a/mdadm.changes +++ b/mdadm.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Feb 16 16:00:11 CET 2009 - mmarek@suse.cz + +- fix segfault when stopping imsm arrays + (bnc#473947, patch by Dan Williams) + ------------------------------------------------------------------- Mon Jan 26 11:47:59 CET 2009 - ro@suse.de diff --git a/mdadm.spec b/mdadm.spec index 8c50be4..57e3e33 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -20,7 +20,7 @@ Name: mdadm Version: 3.0 -Release: 13 +Release: 14 %define ver 3.0-devel2 BuildRequires: sgmltool PreReq: %fillup_prereq %insserv_prereq @@ -42,6 +42,7 @@ Patch7: intel.fixes.patch Patch8: name.fixes.patch Patch9: mdmon-pass-symbolic-name-to-mdmon-instead-of-device.patch Patch10: don-t-auto-assemble-if-any-arrays-are-list.patch +Patch11: manage-rebuild-map-for-kpartx Source1: Software-RAID.HOWTO.tar.bz2 Source2: sysconfig.mdadm Source3: mdadmd @@ -72,6 +73,7 @@ Authors: %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 %build %{suse_update_config -f} @@ -160,6 +162,9 @@ rm -rf $RPM_BUILD_ROOT /lib/mkinitrd/scripts/boot-md.sh %changelog +* Mon Feb 16 2009 mmarek@suse.cz +- fix segfault when stopping imsm arrays + (bnc#473947, patch by Dan Williams) * Mon Jan 26 2009 ro@suse.de - change fillup call from "-Y" to "-y" the boot script has been present in this package for long enough (SLES10-GA)