diff --git a/0001-Add-missing-space-in-detail-brief-output.patch b/0001-Add-missing-space-in-detail-brief-output.patch deleted file mode 100644 index 34e888c..0000000 --- a/0001-Add-missing-space-in-detail-brief-output.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0e90271e53c0f6efb33e904cf407498350e2a14d Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 1 Oct 2009 12:38:31 +1000 -Subject: [PATCH 1/2] Add missing space in "--detail --brief" output. - -We need a space between the device name and the word "level".. - -Signed-off-by: NeilBrown ---- - Detail.c | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Detail.c b/Detail.c -index 001012a..a70db34 100644 ---- a/Detail.c -+++ b/Detail.c -@@ -207,11 +207,11 @@ int Detail(char *dev, int brief, int export, int test, char *homehost) - printf("ARRAY %s", dev); - if (brief > 1) { - if (array.raid_disks) -- printf("level=%s num-devices=%d", -+ printf(" level=%s num-devices=%d", - c?c:"-unknown-", - array.raid_disks ); - else -- printf("level=container num-devices=%d", -+ printf(" level=container num-devices=%d", - array.nr_disks); - } - if (container) { --- -1.6.3.3 diff --git a/0002-Fix-null-dereference-in-set_member_info.patch b/0002-Fix-null-dereference-in-set_member_info.patch deleted file mode 100644 index dfbb818..0000000 --- a/0002-Fix-null-dereference-in-set_member_info.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 2b9aa337af7291d3f141322da96c9f667c99d53c Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 1 Oct 2009 12:51:04 +1000 -Subject: [PATCH 2/2] Fix null-dereference in set_member_info - -set_member_info would try to dereference ->metadata_version, without -checking that it isn't NULL. - -Signed-off-by: NeilBrown ---- - mapfile.c | 15 +++++++++------ - 1 files changed, 9 insertions(+), 6 deletions(-) - -diff --git a/mapfile.c b/mapfile.c -index a3038be..ed59db5 100644 ---- a/mapfile.c -+++ b/mapfile.c -@@ -303,19 +303,22 @@ struct map_ent *map_by_name(struct map_ent **map, char *name) - */ - static void set_member_info(struct supertype *st, struct mdstat_ent *ent) - { -- char version[strlen(ent->metadata_version)+1]; - - st->subarray[0] = '\0'; - -- if (strncmp(ent->metadata_version, "external:", 9) != 0) -+ if (ent->metadata_version == NULL || -+ strncmp(ent->metadata_version, "external:", 9) != 0) - return; - -- strcpy(version, ent->metadata_version); -- -- if (is_subarray(&version[9])) { -- char *subarray = strrchr(version, '/'); -+ if (is_subarray(&ent->metadata_version[9])) { -+ char version[strlen(ent->metadata_version)+1]; -+ char *subarray; - char *name = &version[10]; - -+ strcpy(version, ent->metadata_version); -+ subarray = strrchr(version, '/'); -+ name = &version[10]; -+ - if (!subarray) - return; - *subarray++ = '\0'; --- -1.6.3.3 diff --git a/Start-kpartx-for-imsm-devices.patch b/Start-kpartx-for-imsm-devices.patch new file mode 100644 index 0000000..9ff2216 --- /dev/null +++ b/Start-kpartx-for-imsm-devices.patch @@ -0,0 +1,131 @@ +From 057fb70bf4e4b284cc06299853122273815b1d6e Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Fri, 7 Nov 2008 22:22:41 +1100 +Subject: [PATCH] Start kpartx for imsm devices. + +This probably wont get into mainline, but is need on SLES +to create partitions that the YaST partitioner has a chance +of recognising. + +Signed-off-by: NeilBrown +--- + Assemble.c | 4 +++- + Create.c | 3 +++ + Manage.c | 4 ++++ + mdadm.h | 1 + + super-intel.c | 2 +- + util.c | 25 +++++++++++++++++++++++++ + 6 files changed, 37 insertions(+), 2 deletions(-) + +diff --git a/Assemble.c b/Assemble.c +index 20c4be7..c597526 100644 +--- a/Assemble.c ++++ b/Assemble.c +@@ -1251,8 +1251,10 @@ int assemble_container_content(struct supertype *st, int mdfd, + fprintf(stderr, " (%d new)", working); + fprintf(stderr, "\n"); + } +- wait_for(chosen_name); + close(mdfd); ++ wait_for(chosen_name); ++ if (st->ss->match_metadata_desc("imsm")) ++ run_kpartx('a', chosen_name); + return 0; + /* FIXME should have an O_EXCL and wait for read-auto */ + } else { +diff --git a/Create.c b/Create.c +index 783ab09..4368107 100644 +--- a/Create.c ++++ b/Create.c +@@ -780,7 +780,10 @@ int Create(struct supertype *st, char *mddev, + ping_monitor(devnum2devname(st->container_dev)); + close(container_fd); + } ++ close(mdfd); + wait_for(chosen_name); ++ if (st->ss->match_metadata_desc("imsm")) ++ run_kpartx('a', chosen_name); + } else { + fprintf(stderr, Name ": not starting array - not enough devices.\n"); + } +diff --git a/Manage.c b/Manage.c +index 9424650..06f9e05 100644 +--- a/Manage.c ++++ b/Manage.c +@@ -219,8 +219,12 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet) + if (mdi && + mdi->array.level > 0 && + is_subarray(mdi->text_version)) { ++ struct map_ent *me = map_by_devnum(&map, devnum); + /* 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.h b/mdadm.h +index 2b34acf..9d819f9 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -833,6 +833,7 @@ extern char *devnum2devname(int num); + extern int devname2devnum(char *name); + extern int stat2devnum(struct stat *st); + extern int fd2devnum(int fd); ++extern void run_kpartx(char mode, char *dev); + + static inline int dev2major(int d) + { +diff --git a/super-intel.c b/super-intel.c +index a2b9bd2..5f06f30 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -636,7 +636,7 @@ static void brief_examine_super_imsm(struct supertype *st) + getinfo_super_imsm(st, &info); + fname_from_uuid(st, &info, nbuf1,'-'); + printf("ARRAY /dev/md/%.16s container=%s\n" +- " member=%d auto=mdp UUID=%s\n", ++ " member=%d auto=md UUID=%s\n", + dev->volume, nbuf + 5, i, nbuf1 + 5); + } + } +diff --git a/util.c b/util.c +index 8845a0f..f21d2bb 100644 +--- a/util.c ++++ b/util.c +@@ -1327,6 +1327,31 @@ void append_metadata_update(struct supertype *st, void *buf, int len) + } + #endif /* MDASSEMBLE */ + ++void run_kpartx(char mode, char *dev) ++{ ++ char buf[1024]; ++ char *cp; ++ ++ sprintf(buf, "/sbin/kpartx > /dev/null 2>&1 -%c '", mode); ++ ++ cp = buf + strlen(buf); ++ while (cp < buf+sizeof(buf)-10 && ++ *dev) { ++ if (*dev == '\'') { ++ *cp++ = '\''; ++ *cp++ = '\\'; ++ *cp++ = '\''; ++ /* *cp++ = '\''; */ ++ } ++ *cp ++ = *dev++; ++ } ++ *cp++ = '\''; ++ *cp++ = 0; ++ system(buf); ++} ++ ++ ++ + #ifdef __TINYC__ + /* tinyc doesn't optimize this check in ioctl.h out ... */ + unsigned int __invalid_size_argument_for_IOC = 0; +-- +1.5.6.5 + 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-3.0.2.tar.bz2 b/mdadm-3.0.2.tar.bz2 deleted file mode 100644 index 2db571a..0000000 --- a/mdadm-3.0.2.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:821c2a073daed4916973226a6c623de5d697cceb077de935e2b1c316b11f3da7 -size 252754 diff --git a/mdadm-3.0.tar.bz2 b/mdadm-3.0.tar.bz2 new file mode 100644 index 0000000..e20f227 --- /dev/null +++ b/mdadm-3.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6fd6ab77c4d996879192edd8ad90cd512165a857795c25c98fc35206df6c2e64 +size 250775 diff --git a/mdadm.changes b/mdadm.changes index 6de6c6a..1c5a09b 100644 --- a/mdadm.changes +++ b/mdadm.changes @@ -1,9 +1,3 @@ -------------------------------------------------------------------- -Thu Oct 1 10:51:38 CEST 2009 - mmarek@suse.cz - -- updated to 3.0.2 + 2 patches - * bugfixes only - ------------------------------------------------------------------- Fri Jun 12 09:43:43 CEST 2009 - mmarek@suse.cz diff --git a/mdadm.spec b/mdadm.spec index 45db418..faf1932 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -19,8 +19,9 @@ Name: mdadm -Version: 3.0.2 +Version: 3.0 Release: 21 +%define ver 3.0 BuildRequires: sgmltool PreReq: %fillup_prereq %insserv_prereq Obsoletes: raidtools @@ -30,9 +31,10 @@ License: GPL v2 or later Url: http://www.kernel.org/pub/linux/utils/raid/mdadm/ Summary: Utility for Configuring MD Setup BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source: %{name}-%{version}.tar.bz2 -Patch1: 0001-Add-missing-space-in-detail-brief-output.patch -Patch2: 0002-Fix-null-dereference-in-set_member_info.patch +Source: %{name}-%{ver}.tar.bz2 +# XXX - still needed? +Patch6: Start-kpartx-for-imsm-devices.patch +Patch11: manage-rebuild-map-for-kpartx Source1: Software-RAID.HOWTO.tar.bz2 Source2: sysconfig.mdadm Source3: mdadmd @@ -52,9 +54,9 @@ Authors: Neil Brown %prep -%setup -q -a1 -%patch1 -p1 -%patch2 -p1 +%setup -q -a1 -n %{name}-%{ver} +#patch6 -p1 +#patch11 -p1 %build %{suse_update_config -f}