Hello community, here is the log from the commit of package mdadm for openSUSE:Factory checked in at Sat Oct 3 00:44:46 CEST 2009. -------- --- mdadm/mdadm.changes 2009-06-12 09:45:37.000000000 +0200 +++ mdadm/mdadm.changes 2009-10-01 10:53:10.000000000 +0200 @@ -1,0 +2,6 @@ +Thu Oct 1 10:51:38 CEST 2009 - mmarek@suse.cz + +- updated to 3.0.2 + 2 patches + * bugfixes only + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- Start-kpartx-for-imsm-devices.patch manage-rebuild-map-for-kpartx mdadm-3.0.tar.bz2 New: ---- 0001-Add-missing-space-in-detail-brief-output.patch 0002-Fix-null-dereference-in-set_member_info.patch mdadm-3.0.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mdadm.spec ++++++ --- /var/tmp/diff_new_pack.sPblKV/_old 2009-10-03 00:43:15.000000000 +0200 +++ /var/tmp/diff_new_pack.sPblKV/_new 2009-10-03 00:43:15.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package mdadm (Version 3.0) +# spec file for package mdadm (Version 3.0.2) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -19,9 +19,8 @@ Name: mdadm -Version: 3.0 -Release: 21 -%define ver 3.0 +Version: 3.0.2 +Release: 1 BuildRequires: sgmltool PreReq: %fillup_prereq %insserv_prereq Obsoletes: raidtools @@ -31,10 +30,9 @@ Url: http://www.kernel.org/pub/linux/utils/raid/mdadm/ Summary: Utility for Configuring MD Setup BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source: %{name}-%{ver}.tar.bz2 -# XXX - still needed? -Patch6: Start-kpartx-for-imsm-devices.patch -Patch11: manage-rebuild-map-for-kpartx +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 Source1: Software-RAID.HOWTO.tar.bz2 Source2: sysconfig.mdadm Source3: mdadmd @@ -54,9 +52,9 @@ Neil Brown <neilb@suse.de> %prep -%setup -q -a1 -n %{name}-%{ver} -#patch6 -p1 -#patch11 -p1 +%setup -q -a1 +%patch1 -p1 +%patch2 -p1 %build %{suse_update_config -f} ++++++ 0001-Add-missing-space-in-detail-brief-output.patch ++++++
From 0e90271e53c0f6efb33e904cf407498350e2a14d Mon Sep 17 00:00:00 2001 From: NeilBrown <neilb@suse.de> 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 <neilb@suse.de> --- 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 ++++++ 0002-Fix-null-dereference-in-set_member_info.patch ++++++
From 2b9aa337af7291d3f141322da96c9f667c99d53c Mon Sep 17 00:00:00 2001 From: NeilBrown <neilb@suse.de> 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 <neilb@suse.de> --- 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 ++++++ mdadm-3.0.tar.bz2 -> mdadm-3.0.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/ANNOUNCE-3.0.1 new/mdadm-3.0.2/ANNOUNCE-3.0.1 --- old/mdadm-3.0/ANNOUNCE-3.0.1 1970-01-01 01:00:00.000000000 +0100 +++ new/mdadm-3.0.2/ANNOUNCE-3.0.1 2009-09-25 09:54:33.000000000 +0200 @@ -0,0 +1,22 @@ +Subject: ANNOUNCE: mdadm 3.0.1 - A tool for managing Soft RAID under Linux + +I am pleased to announce the availability of + mdadm version 3.0.1 + +It is available at the usual places: + countrycode=xx. + http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/ +and via git at + git://neil.brown.name/mdadm + http://neil.brown.name/git?p=mdadm + + +This contains only minor bug fixes over 3.0. If you are using +3.0, you could consider upgrading. + +The brief change log is: + - Fix various segfaults + - Fixed for --examine with containers + - Lots of other little fixes. + +NeilBrown 25th September 2009 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/ANNOUNCE-3.0.2 new/mdadm-3.0.2/ANNOUNCE-3.0.2 --- old/mdadm-3.0/ANNOUNCE-3.0.2 1970-01-01 01:00:00.000000000 +0100 +++ new/mdadm-3.0.2/ANNOUNCE-3.0.2 2009-09-25 10:19:15.000000000 +0200 @@ -0,0 +1,21 @@ +Subject: ANNOUNCE: mdadm 3.0.2 - A tool for managing Soft RAID under Linux + +I am pleased to announce the availability of + mdadm version 3.0.2 + +It is available at the usual places: + countrycode=xx. + http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/ +and via git at + git://neil.brown.name/mdadm + http://neil.brown.name/git?p=mdadm + + +This just contains one bugfix over 3.0.1 - I was obviously a bit hasty +in releasing that one. + +The brief change log is: + - Fix crash when hosthost is not set, as often happens in + early boot. + +NeilBrown 25th September 2009 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/Assemble.c new/mdadm-3.0.2/Assemble.c --- old/mdadm-3.0/Assemble.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/Assemble.c 2009-09-25 09:54:33.000000000 +0200 @@ -320,6 +320,8 @@ content = tmpdev->content; else content = tst->ss->container_content(tst); + if (!content) + goto loop; /* empty container */ tmpdev->content = content->next; if (tmpdev->content == NULL) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/ChangeLog new/mdadm-3.0.2/ChangeLog --- old/mdadm-3.0/ChangeLog 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/ChangeLog 2009-09-25 10:19:15.000000000 +0200 @@ -1,7 +1,16 @@ Please see git logs for detailed change log. This file just contains highlight. -Changed Prior to release 3.0 +Changes Prior to release 3.0.2 + - Fix crash when hosthost is not set, as often happens in + early boot. + +Changes Prior to release 3.0.1 + - Fix various segfaults + - Fixed for --examine with containers + - Lots of other little fixes. + +Changes Prior to release 3.0 - Support for externally managed metadata, specifically DDF and IMSM. - Depend on udev to create entries in /dev, rather than creating them ourselves. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/Create.c new/mdadm-3.0.2/Create.c --- old/mdadm-3.0/Create.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/Create.c 2009-09-25 09:54:33.000000000 +0200 @@ -792,7 +792,39 @@ dv == moved_disk && dnum != insert_point) break; } if (pass == 1) { + struct mdinfo info_new; + struct map_ent *me = NULL; + + /* check to see if the uuid has changed due to these + * metadata changes, and if so update the member array + * and container uuid. Note ->write_init_super clears + * the subarray cursor such that ->getinfo_super once + * again returns container info. + */ + map_lock(&map); + st->ss->getinfo_super(st, &info_new); + if (st->ss->external && level != LEVEL_CONTAINER && + !same_uuid(info_new.uuid, info.uuid, 0)) { + map_update(&map, fd2devnum(mdfd), + info_new.text_version, + info_new.uuid, chosen_name); + me = map_by_devnum(&map, st->container_dev); + } + st->ss->write_init_super(st); + + /* update parent container uuid */ + if (me) { + char *path = strdup(me->path); + + st->ss->getinfo_super(st, &info_new); + map_update(&map, st->container_dev, + info_new.text_version, + info_new.uuid, path); + free(path); + } + map_unlock(&map); + flush_metadata_updates(st); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/Detail.c new/mdadm-3.0.2/Detail.c --- old/mdadm-3.0/Detail.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/Detail.c 2009-09-25 09:54:33.000000000 +0200 @@ -122,12 +122,25 @@ disk.minor == 0) continue; if ((dv=map_dev(disk.major, disk.minor, 1))) { - if ((!st || !st->sb) && + /* some formats (imsm) have free-floating-spares + * with a uuid of uuid_match_any, they don't + * have very good info about the rest of the + * container, so keep searching when + * encountering such a device. Otherwise, stop + * after the first successful call to + * ->load_super. + */ + int free_spare = memcmp(uuid_match_any, + info.uuid, + sizeof(uuid_match_any)) == 0; + if ((!st || !st->sb || free_spare) && (array.raid_disks == 0 || (disk.state & (1<<MD_DISK_ACTIVE)))) { /* try to read the superblock from this device * to get more info */ + if (free_spare) + st->ss->free_super(st); int fd2 = dev_open(dv, O_RDONLY); if (fd2 >=0 && st && st->ss->load_super(st, fd2, NULL) == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/Examine.c new/mdadm-3.0.2/Examine.c --- old/mdadm-3.0/Examine.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/Examine.c 2009-09-25 09:54:33.000000000 +0200 @@ -63,7 +63,7 @@ } *arrays = NULL; for (; devlist ; devlist=devlist->next) { - struct supertype *st = forcest; + struct supertype *st; fd = dev_open(devlist->devname, O_RDONLY); if (fd < 0) { @@ -75,7 +75,9 @@ err = 1; } else { - if (!st) + if (forcest) + st = dup_super(forcest); + else st = guess_super(fd); if (st) err = st->ss->load_super(st, fd, @@ -114,11 +116,10 @@ ap->st = st; arrays = ap; st->ss->getinfo_super(st, &ap->info); - } else { + } else st->ss->getinfo_super(st, &ap->info); - st->ss->free_super(st); - } - if (!(ap->info.disk.state & (1<<MD_DISK_SYNC))) + if (!st->loaded_container && + !(ap->info.disk.state & (1<<MD_DISK_SYNC))) ap->spares++; d = dl_strdup(devlist->devname); dl_add(ap->devs, d); @@ -136,15 +137,23 @@ for (ap=arrays; ap; ap=ap->next) { char sep='='; char *d; + int newline = 0; + ap->st->ss->brief_examine_super(ap->st, brief > 1); - if (ap->spares) printf(" spares=%d", ap->spares); + if (ap->spares) + newline += printf(" spares=%d", ap->spares); if (brief > 1) { - printf(" devices"); + newline += printf(" devices"); for (d=dl_next(ap->devs); d!= ap->devs; d=dl_next(d)) { printf("%c%s", sep, d); sep=','; } } + if (ap->st->ss->brief_examine_subarrays) { + if (newline) + printf("\n"); + ap->st->ss->brief_examine_subarrays(ap->st, brief > 1); + } ap->st->ss->free_super(ap->st); /* FIXME free ap */ if (ap->spares || brief > 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/Monitor.c new/mdadm-3.0.2/Monitor.c --- old/mdadm-3.0/Monitor.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/Monitor.c 2009-09-25 09:54:33.000000000 +0200 @@ -581,7 +581,7 @@ n=fwrite(buf, 1, n, mp); /* yes, i don't care about the result */ fclose(mdstat); } - fclose(mp); + pclose(mp); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/ReadMe.c new/mdadm-3.0.2/ReadMe.c --- old/mdadm-3.0/ReadMe.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/ReadMe.c 2009-09-25 10:19:15.000000000 +0200 @@ -24,7 +24,7 @@ #include "mdadm.h" -char Version[] = Name " - v3.0 - 2nd June 2009\n"; +char Version[] = Name " - v3.0.2 - 25th September 2009\n"; /* * File: ReadMe.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/inventory new/mdadm-3.0.2/inventory --- old/mdadm-3.0/inventory 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/inventory 2009-09-25 10:19:15.000000000 +0200 @@ -1,5 +1,7 @@ ANNOUNCE-3.0 +ANNOUNCE-3.0.1 +ANNOUNCE-3.0.2 Assemble.c bitmap.c bitmap.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/mapfile.c new/mdadm-3.0.2/mapfile.c --- old/mdadm-3.0/mapfile.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/mapfile.c 2009-09-25 09:54:33.000000000 +0200 @@ -297,6 +297,34 @@ return NULL; } +/* sets the proper subarray and container_dev according to the metadata + * version super_by_fd does this automatically, this routine is meant as + * a supplement for guess_super() + */ +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) + return; + + strcpy(version, ent->metadata_version); + + if (is_subarray(&version[9])) { + char *subarray = strrchr(version, '/'); + char *name = &version[10]; + + if (!subarray) + return; + *subarray++ = '\0'; + + st->container_dev = devname2devnum(name); + strncpy(st->subarray, subarray, sizeof(st->subarray)); + } +} + void RebuildMap(void) { struct mdstat_ent *mdstat = mdstat_read(0, 0); @@ -337,8 +365,10 @@ st = guess_super(dfd); if ( st == NULL) ok = -1; - else + else { + set_member_info(st, md); ok = st->ss->load_super(st, dfd, NULL); + } close(dfd); if (ok != 0) continue; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/mdadm.8 new/mdadm-3.0.2/mdadm.8 --- old/mdadm-3.0/mdadm.8 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/mdadm.8 2009-09-25 10:19:15.000000000 +0200 @@ -5,7 +5,7 @@ ." the Free Software Foundation; either version 2 of the License, or ." (at your option) any later version. ." See file COPYING in distribution for details. -.TH MDADM 8 "" v3.0 +.TH MDADM 8 "" v3.0.2 .SH NAME mdadm - manage MD devices .I aka diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/mdadm.h new/mdadm-3.0.2/mdadm.h --- old/mdadm-3.0/mdadm.h 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/mdadm.h 2009-09-25 09:54:33.000000000 +0200 @@ -436,6 +436,7 @@ */ void (*examine_super)(struct supertype *st, char *homehost); void (*brief_examine_super)(struct supertype *st, int verbose); + void (*brief_examine_subarrays)(struct supertype *st, int verbose); void (*export_examine_super)(struct supertype *st); /* Used to report details of an active array. @@ -848,6 +849,7 @@ extern int mdmon_running(int devnum); extern int signal_mdmon(int devnum); extern int check_env(char *name); +extern __u32 random32(void); extern int start_mdmon(int devnum); extern char *devnum2devname(int num); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/mdadm.spec new/mdadm-3.0.2/mdadm.spec --- old/mdadm-3.0/mdadm.spec 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/mdadm.spec 2009-09-25 10:19:15.000000000 +0200 @@ -1,6 +1,6 @@ Summary: mdadm is used for controlling Linux md devices (aka RAID arrays) Name: mdadm -Version: 3.0 +Version: 3.0.2 Release: 1 Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tgz URL: http://neil.brown.name/blog/mdadm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/mdassemble.8 new/mdadm-3.0.2/mdassemble.8 --- old/mdadm-3.0/mdassemble.8 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/mdassemble.8 2009-09-25 10:19:15.000000000 +0200 @@ -1,5 +1,5 @@ ." -*- nroff -*- -.TH MDASSEMBLE 8 "" v3.0 +.TH MDASSEMBLE 8 "" v3.0.2 .SH NAME mdassemble - assemble MD devices .I aka diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/mdmon.8 new/mdadm-3.0.2/mdmon.8 --- old/mdadm-3.0/mdmon.8 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/mdmon.8 2009-09-25 10:19:15.000000000 +0200 @@ -1,5 +1,5 @@ ." See file COPYING in distribution for details. -.TH MDMON 8 "" v3.0 +.TH MDMON 8 "" v3.0.2 .SH NAME mdmon - monitor MD external metadata arrays diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/mdmon.c new/mdadm-3.0.2/mdmon.c --- old/mdadm-3.0/mdmon.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/mdmon.c 2009-09-25 09:54:33.000000000 +0200 @@ -395,7 +395,7 @@ } else pfd[0] = pfd[1] = -1; - container = malloc(sizeof(*container)); + container = calloc(1, sizeof(*container)); container->devnum = devnum; container->devname = devname; container->arrays = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/platform-intel.c new/mdadm-3.0.2/platform-intel.c --- old/mdadm-3.0/platform-intel.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/platform-intel.c 2009-09-25 09:54:33.000000000 +0200 @@ -90,7 +90,7 @@ list->path = canonicalize_file_name(path); list->next = NULL; } - + closedir(driver_dir); return head; } @@ -157,6 +157,7 @@ const struct imsm_orom *find_imsm_orom(void) { static int populated = 0; + unsigned long align; /* it's static data so we only need to read it once */ if (populated) @@ -184,7 +185,11 @@ return NULL; /* scan option-rom memory looking for an imsm signature */ - if (probe_roms_init() != 0) + if (check_env("IMSM_SAFE_OROM_SCAN")) + align = 2048; + else + align = 512; + if (probe_roms_init(align) != 0) return NULL; probe_roms(); populated = scan_adapter_roms(scan); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/probe_roms.c new/mdadm-3.0.2/probe_roms.c --- old/mdadm-3.0/probe_roms.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/probe_roms.c 2009-09-25 09:54:33.000000000 +0200 @@ -32,6 +32,8 @@ static int rom_fd = -1; const static int rom_len = 0xf0000 - 0xc0000; /* option-rom memory region */ static int _sigbus; +static unsigned long rom_align; + #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) static void sigbus(int sig) @@ -76,11 +78,20 @@ } } -int probe_roms_init(void) +int probe_roms_init(unsigned long align) { int fd; int rc = 0; + /* valid values are 2048 and 512. 512 is for PCI-3.0 compliant + * systems, or systems that do not have dangerous/legacy ISA + * devices. 2048 should always be safe + */ + if (align == 512 || align == 2048) + rom_align = align; + else + return -1; + if (signal(SIGBUS, sigbus) == SIG_ERR) rc = -1; if (rc == 0) { @@ -208,6 +219,11 @@ return found; } +static unsigned long align(unsigned long addr, unsigned long alignment) +{ + return (addr + alignment - 1) & ~(alignment - 1); +} + void probe_roms(void) { const void *rom; @@ -220,7 +236,7 @@ /* video rom */ upper = adapter_rom_resources[0].start; - for (start = video_rom_resource.start; start < upper; start += 2048) { + for (start = video_rom_resource.start; start < upper; start += rom_align) { rom = isa_bus_to_virt(start); if (!romsignature(rom)) continue; @@ -239,7 +255,7 @@ break; } - start = (video_rom_resource.end + 1 + 2047) & ~2047UL; + start = align(video_rom_resource.end + 1, rom_align); if (start < upper) start = upper; @@ -255,7 +271,7 @@ } /* check for adapter roms on 2k boundaries */ - for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) { + for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += rom_align) { rom = isa_bus_to_virt(start); if (!romsignature(rom)) continue; @@ -273,7 +289,7 @@ adapter_rom_resources[i].start = start; adapter_rom_resources[i].end = start + length - 1; - start = adapter_rom_resources[i++].end & ~2047UL; + start = adapter_rom_resources[i++].end & ~(rom_align - 1); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/probe_roms.h new/mdadm-3.0.2/probe_roms.h --- old/mdadm-3.0/probe_roms.h 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/probe_roms.h 2009-09-25 09:54:33.000000000 +0200 @@ -18,7 +18,7 @@ */ void probe_roms_exit(void); -int probe_roms_init(void); +int probe_roms_init(unsigned long align); typedef int (*scan_fn)(const void *start, const void *end); int scan_adapter_roms(scan_fn fn); void probe_roms(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/super-ddf.c new/mdadm-3.0.2/super-ddf.c --- old/mdadm-3.0/super-ddf.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/super-ddf.c 2009-09-25 09:54:33.000000000 +0200 @@ -762,6 +762,9 @@ static int load_super_ddf_all(struct supertype *st, int fd, void **sbp, char *devname, int keep_fd); #endif + +static void free_super_ddf(struct supertype *st); + static int load_super_ddf(struct supertype *st, int fd, char *devname) { @@ -798,6 +801,8 @@ return 1; } + free_super_ddf(st); + if (posix_memalign((void**)&super, 512, sizeof(*super))!= 0) { fprintf(stderr, Name ": malloc of %zu failed.\n", sizeof(*super)); @@ -835,6 +840,18 @@ return rv; } + if (st->subarray[0]) { + struct vcl *v; + + for (v = super->conflist; v; v = v->next) + if (v->vcnum == atoi(st->subarray)) + super->currentconf = v; + if (!super->currentconf) { + free(super); + return 1; + } + } + /* Should possibly check the sections .... */ st->sb = super; @@ -1166,13 +1183,24 @@ { /* We just write a generic DDF ARRAY entry */ + struct mdinfo info; + char nbuf[64]; + getinfo_super_ddf(st, &info); + fname_from_uuid(st, &info, nbuf, ':'); + + printf("ARRAY metadata=ddf UUID=%s\n", nbuf + 5); +} + +static void brief_examine_subarrays_ddf(struct supertype *st, int verbose) +{ + /* We just write a generic DDF ARRAY entry + */ struct ddf_super *ddf = st->sb; struct mdinfo info; int i; char nbuf[64]; getinfo_super_ddf(st, &info); fname_from_uuid(st, &info, nbuf, ':'); - printf("ARRAY metadata=ddf UUID=%s\n", nbuf + 5); for (i=0; i<__be16_to_cpu(ddf->virt->max_vdes); i++) { struct virtual_entry *ve = &ddf->virt->entries[i]; @@ -1495,17 +1523,6 @@ return rv; } -__u32 random32(void) -{ - __u32 rv; - int rfd = open("/dev/urandom", O_RDONLY); - if (rfd < 0 || read(rfd, &rv, 4) != 4) - rv = random(); - if (rfd >= 0) - close(rfd); - return rv; -} - static void make_header_guid(char *guid) { __u32 stamp; @@ -2345,15 +2362,19 @@ static int write_init_super_ddf(struct supertype *st) { + struct ddf_super *ddf = st->sb; + struct vcl *currentconf = ddf->currentconf; + + /* we are done with currentconf reset it to point st at the container */ + ddf->currentconf = NULL; if (st->update_tail) { /* queue the virtual_disk and vd_config as metadata updates */ struct virtual_disk *vd; struct vd_config *vc; - struct ddf_super *ddf = st->sb; int len; - if (!ddf->currentconf) { + if (!currentconf) { int len = (sizeof(struct phys_disk) + sizeof(struct phys_disk_entry)); @@ -2372,14 +2393,14 @@ len = sizeof(struct virtual_disk) + sizeof(struct virtual_entry); vd = malloc(len); *vd = *ddf->virt; - vd->entries[0] = ddf->virt->entries[ddf->currentconf->vcnum]; - vd->populated_vdes = __cpu_to_be16(ddf->currentconf->vcnum); + vd->entries[0] = ddf->virt->entries[currentconf->vcnum]; + vd->populated_vdes = __cpu_to_be16(currentconf->vcnum); append_metadata_update(st, vd, len); /* Then the vd_config */ len = ddf->conf_rec_len * 512; vc = malloc(len); - memcpy(vc, &ddf->currentconf->conf, len); + memcpy(vc, ¤tconf->conf, len); append_metadata_update(st, vc, len); /* FIXME I need to close the fds! */ @@ -3587,6 +3608,7 @@ #ifndef MDASSEMBLE .examine_super = examine_super_ddf, .brief_examine_super = brief_examine_super_ddf, + .brief_examine_subarrays = brief_examine_subarrays_ddf, .export_examine_super = export_examine_super_ddf, .detail_super = detail_super_ddf, .brief_detail_super = brief_detail_super_ddf, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/super-intel.c new/mdadm-3.0.2/super-intel.c --- old/mdadm-3.0/super-intel.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/super-intel.c 2009-09-25 09:54:33.000000000 +0200 @@ -64,7 +64,6 @@ #define SPARE_DISK __cpu_to_le32(0x01) /* Spare */ #define CONFIGURED_DISK __cpu_to_le32(0x02) /* Member of some RaidDev */ #define FAILED_DISK __cpu_to_le32(0x04) /* Permanent failure */ -#define USABLE_DISK __cpu_to_le32(0x08) /* Fully usable unless FAILED_DISK is set */ __u32 status; /* 0xF0 - 0xF3 */ __u32 owner_cfg_num; /* which config 0,1,2... owns this disk */ #define IMSM_DISK_FILLERS 4 @@ -247,6 +246,7 @@ int creating_imsm; /* flag to indicate container creation */ int current_vol; /* index of raid device undergoing creation */ __u32 create_offset; /* common start for 'current_vol' */ + __u32 random; /* random data for seeding new family numbers */ struct intel_dev *devlist; struct dl { struct dl *next; @@ -686,10 +686,9 @@ snprintf(str, MAX_RAID_SERIAL_LEN + 1, "%s", disk->serial); printf(" Disk%02d Serial : %s\n", index, str); s = disk->status; - printf(" State :%s%s%s%s\n", s&SPARE_DISK ? " spare" : "", + printf(" State :%s%s%s\n", s&SPARE_DISK ? " spare" : "", s&CONFIGURED_DISK ? " active" : "", - s&FAILED_DISK ? " failed" : "", - s&USABLE_DISK ? " usable" : ""); + s&FAILED_DISK ? " failed" : ""); printf(" Id : %08x\n", __le32_to_cpu(disk->scsi_id)); sz = __le32_to_cpu(disk->total_blocks) - reserved; printf(" Usable Size : %llu%s\n", (unsigned long long)sz, @@ -714,6 +713,7 @@ printf(" Magic : %s\n", str); snprintf(str, strlen(MPB_VERSION_RAID0), "%s", get_imsm_version(mpb)); printf(" Version : %s\n", get_imsm_version(mpb)); + printf(" Orig Family : %08x\n", __le32_to_cpu(mpb->orig_family_num)); printf(" Family : %08x\n", __le32_to_cpu(mpb->family_num)); printf(" Generation : %08x\n", __le32_to_cpu(mpb->generation_num)); getinfo_super_imsm(st, &info); @@ -759,6 +759,23 @@ /* We just write a generic IMSM ARRAY entry */ struct mdinfo info; char nbuf[64]; + struct intel_super *super = st->sb; + + if (!super->anchor->num_raid_devs) { + printf("ARRAY metadata=imsm\n"); + return; + } + + getinfo_super_imsm(st, &info); + fname_from_uuid(st, &info, nbuf, ':'); + printf("ARRAY metadata=imsm UUID=%s\n", nbuf + 5); +} + +static void brief_examine_subarrays_imsm(struct supertype *st, int verbose) +{ + /* We just write a generic IMSM ARRAY entry */ + struct mdinfo info; + char nbuf[64]; char nbuf1[64]; struct intel_super *super = st->sb; int i; @@ -768,7 +785,6 @@ getinfo_super_imsm(st, &info); fname_from_uuid(st, &info, nbuf, ':'); - printf("ARRAY metadata=imsm UUID=%s\n", nbuf + 5); for (i = 0; i < super->anchor->num_raid_devs; i++) { struct imsm_dev *dev = get_imsm_dev(super, i); @@ -1089,7 +1105,7 @@ /* the imsm metadata format does not specify any host * identification information. We return -1 since we can never * confirm nor deny whether a given array is "meant" for this - * host. We rely on compare_super and the 'family_num' field to + * host. We rely on compare_super and the 'family_num' fields to * exclude member disks that do not belong, and we rely on * mdadm.conf to specify the arrays that should be assembled. * Auto-assembly may still pick up "foreign" arrays. @@ -1117,7 +1133,7 @@ */ /* imsm does not track uuid's so we synthesis one using sha1 on * - The signature (Which is constant for all imsm array, but no matter) - * - the family_num of the container + * - the orig_family_num of the container * - the index number of the volume * - the 'serial' number of the volume. * Hopefully these are all constant. @@ -1127,10 +1143,18 @@ char buf[20]; struct sha1_ctx ctx; struct imsm_dev *dev = NULL; + __u32 family_num; + /* some mdadm versions failed to set ->orig_family_num, in which + * case fall back to ->family_num. orig_family_num will be + * fixed up with the first metadata update. + */ + family_num = super->anchor->orig_family_num; + if (family_num == 0) + family_num = super->anchor->family_num; sha1_init_ctx(&ctx); sha1_process_bytes(super->anchor->sig, MPB_SIG_LEN, &ctx); - sha1_process_bytes(&super->anchor->family_num, sizeof(__u32), &ctx); + sha1_process_bytes(&family_num, sizeof(__u32), &ctx); if (super->current_vol >= 0) dev = get_imsm_dev(super, super->current_vol); if (dev) { @@ -1256,7 +1280,11 @@ struct supertype *_cst; /* container supertype */ _cst = array_list->st; - _sst = _cst->ss->match_metadata_desc(inf->text_version); + if (_cst) + _sst = _cst->ss->match_metadata_desc(inf->text_version); + else + _sst = NULL; + if (_sst) { memcpy(inf->uuid, array_list->uuid, sizeof(int[4])); free(_sst); @@ -1438,7 +1466,8 @@ */ if (first->anchor->num_raid_devs > 0 && sec->anchor->num_raid_devs > 0) { - if (first->anchor->family_num != sec->anchor->family_num) + if (first->anchor->orig_family_num != sec->anchor->orig_family_num || + first->anchor->family_num != sec->anchor->family_num) return 3; } @@ -1468,17 +1497,17 @@ dv->next = first->devlist; first->devlist = dv; } - if (i <= sec->anchor->num_raid_devs) { + if (i < sec->anchor->num_raid_devs) { /* allocation failure */ free_devlist(first); fprintf(stderr, "imsm: failed to associate spare\n"); return 3; } - for (i = 0; i < sec->anchor->num_raid_devs; i++) - imsm_copy_dev(get_imsm_dev(first, i), get_imsm_dev(sec, i)); - first->anchor->num_raid_devs = sec->anchor->num_raid_devs; + first->anchor->orig_family_num = sec->anchor->orig_family_num; first->anchor->family_num = sec->anchor->family_num; + for (i = 0; i < sec->anchor->num_raid_devs; i++) + imsm_copy_dev(get_imsm_dev(first, i), get_imsm_dev(sec, i)); } return 0; @@ -2167,8 +2196,10 @@ if (st->subarray[0]) { if (atoi(st->subarray) <= super->anchor->num_raid_devs) super->current_vol = atoi(st->subarray); - else + else { + free_imsm(super); return 1; + } } *sbp = super; @@ -2193,8 +2224,8 @@ if (load_super_imsm_all(st, fd, &st->sb, devname, 1) == 0) return 0; #endif - if (st->subarray[0]) - return 1; /* FIXME */ + + free_super_imsm(st); super = alloc_super(0); if (!super) { @@ -2215,6 +2246,15 @@ return rv; } + if (st->subarray[0]) { + if (atoi(st->subarray) <= super->anchor->num_raid_devs) + super->current_vol = atoi(st->subarray); + else { + free_imsm(super); + return 1; + } + } + st->sb = super; if (st->ss == NULL) { st->ss = &super_imsm; @@ -2526,7 +2566,7 @@ super->anchor->num_disks++; } set_imsm_ord_tbl_ent(map, dk->number, dl->index); - dl->disk.status = CONFIGURED_DISK | USABLE_DISK; + dl->disk.status = CONFIGURED_DISK; /* if we are creating the first raid device update the family number */ if (super->current_vol == 0) { @@ -2536,8 +2576,10 @@ *_dev = *dev; *_disk = dl->disk; - sum = __gen_imsm_checksum(mpb); + sum = random32(); + sum += __gen_imsm_checksum(mpb); mpb->family_num = __cpu_to_le32(sum); + mpb->orig_family_num = mpb->family_num; } return 0; @@ -2592,7 +2634,7 @@ size /= 512; serialcpy(dd->disk.serial, dd->serial); dd->disk.total_blocks = __cpu_to_le32(size); - dd->disk.status = USABLE_DISK | SPARE_DISK; + dd->disk.status = SPARE_DISK; if (sysfs_disk_to_scsi_id(fd, &id) == 0) dd->disk.scsi_id = __cpu_to_le32(id); else @@ -2634,6 +2676,7 @@ mpb->disk[0] = d->disk; sum = __gen_imsm_checksum(mpb); mpb->family_num = __cpu_to_le32(sum); + mpb->orig_family_num = 0; sum = __gen_imsm_checksum(mpb); mpb->check_sum = __cpu_to_le32(sum); @@ -2668,6 +2711,12 @@ generation++; mpb->generation_num = __cpu_to_le32(generation); + /* fix up cases where previous mdadm releases failed to set + * orig_family_num + */ + if (mpb->orig_family_num == 0) + mpb->orig_family_num = mpb->family_num; + mpb_size += sizeof(struct imsm_disk) * mpb->num_disks; for (d = super->disks; d; d = d->next) { if (d->index == -1) @@ -2711,17 +2760,16 @@ } -static int create_array(struct supertype *st) +static int create_array(struct supertype *st, int dev_idx) { size_t len; struct imsm_update_create_array *u; struct intel_super *super = st->sb; - struct imsm_dev *dev = get_imsm_dev(super, super->current_vol); + struct imsm_dev *dev = get_imsm_dev(super, dev_idx); struct imsm_map *map = get_imsm_map(dev, 0); struct disk_info *inf; struct imsm_disk *disk; int i; - int idx; len = sizeof(*u) - sizeof(*dev) + sizeof_imsm_dev(dev, 0) + sizeof(*inf) * map->num_members; @@ -2733,11 +2781,12 @@ } u->type = update_create_array; - u->dev_idx = super->current_vol; + u->dev_idx = dev_idx; imsm_copy_dev(&u->dev, dev); inf = get_disk_info(u); for (i = 0; i < map->num_members; i++) { - idx = get_imsm_disk_idx(dev, i); + int idx = get_imsm_disk_idx(dev, i); + disk = get_imsm_disk(super, idx); serialcpy(inf[i].serial, disk->serial); } @@ -2771,21 +2820,26 @@ static int write_init_super_imsm(struct supertype *st) { + struct intel_super *super = st->sb; + int current_vol = super->current_vol; + + /* we are done with current_vol reset it to point st at the container */ + super->current_vol = -1; + if (st->update_tail) { /* queue the recently created array / added disk * as a metadata update */ - struct intel_super *super = st->sb; struct dl *d; int rv; /* determine if we are creating a volume or adding a disk */ - if (super->current_vol < 0) { + if (current_vol < 0) { /* in the add disk case we are running in mdmon * context, so don't close fd's */ return _add_disk(st); } else - rv = create_array(st); + rv = create_array(st, current_vol); for (d = super->disks; d ; d = d->next) { close(d->fd); @@ -3406,8 +3460,6 @@ s = d ? d->disk.status : 0; if (s & FAILED_DISK) skip = 1; - if (!(s & USABLE_DISK)) - skip = 1; if (ord & IMSM_ORD_REBUILD) skip = 1; @@ -3628,8 +3680,9 @@ return 0; disk->status |= FAILED_DISK; + disk->status &= ~CONFIGURED_DISK; set_imsm_ord_tbl_ent(map, slot, idx | IMSM_ORD_REBUILD); - if (map->failed_disk_num == ~0) + if (~map->failed_disk_num == 0) map->failed_disk_num = slot; return 1; } @@ -3840,14 +3893,13 @@ int idx = get_imsm_disk_idx(dev, slot); struct imsm_super *mpb = super->anchor; struct imsm_map *map; - unsigned long long esize; unsigned long long pos; struct mdinfo *d; struct extent *ex; int i, j; int found; __u32 array_start; - __u32 blocks; + __u32 array_end; struct dl *dl; for (dl = super->disks; dl; dl = dl->next) { @@ -3899,15 +3951,14 @@ j = 0; pos = 0; array_start = __le32_to_cpu(map->pba_of_lba0); - blocks = __le32_to_cpu(map->blocks_per_member); + array_end = array_start + + __le32_to_cpu(map->blocks_per_member) - 1; do { /* check that we can start at pba_of_lba0 with * blocks_per_member of space */ - esize = ex[j].start - pos; - if (array_start >= pos && - array_start + blocks < ex[j].start) { + if (array_start >= pos && array_end < ex[j].start) { found = 1; break; } @@ -3921,9 +3972,8 @@ free(ex); if (i < mpb->num_raid_devs) { - dprintf("%x:%x does not have %u at %u\n", - dl->major, dl->minor, - blocks, array_start); + dprintf("%x:%x does not have %u to %u available\n", + dl->major, dl->minor, array_start, array_end); /* No room */ continue; } @@ -4025,6 +4075,7 @@ di->data_offset = __le32_to_cpu(map->pba_of_lba0); di->component_size = a->info.component_size; di->container_member = inst; + super->random = random32(); di->next = rv; rv = di; num_spares++; @@ -4191,6 +4242,15 @@ set_imsm_ord_tbl_ent(map, u->slot, dl->index); set_imsm_ord_tbl_ent(migr_map, u->slot, dl->index | IMSM_ORD_REBUILD); + /* update the family_num to mark a new container + * generation, being careful to record the existing + * family_num in orig_family_num to clean up after + * earlier mdadm versions that neglected to set it. + */ + if (mpb->orig_family_num == 0) + mpb->orig_family_num = mpb->family_num; + mpb->family_num += super->random; + /* count arrays using the victim in the metadata */ found = 0; for (a = st->arrays; a ; a = a->next) { @@ -4504,6 +4564,7 @@ #ifndef MDASSEMBLE .examine_super = examine_super_imsm, .brief_examine_super = brief_examine_super_imsm, + .brief_examine_subarrays = brief_examine_subarrays_imsm, .export_examine_super = export_examine_super_imsm, .detail_super = detail_super_imsm, .brief_detail_super = brief_detail_super_imsm, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/super0.c new/mdadm-3.0.2/super0.c --- old/mdadm-3.0/super0.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/super0.c 2009-09-25 10:19:15.000000000 +0200 @@ -305,9 +305,13 @@ { mdp_super_t *sb = st->sb; char buf[20]; - char *hash = sha1_buffer(homehost, - strlen(homehost), - buf); + char *hash; + + if (!homehost) + return 0; + hash = sha1_buffer(homehost, + strlen(homehost), + buf); return (memcmp(&sb->set_uuid2, hash, 8)==0); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/super1.c new/mdadm-3.0.2/super1.c --- old/mdadm-3.0/super1.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/super1.c 2009-09-25 09:54:33.000000000 +0200 @@ -685,6 +685,8 @@ __u32 r[4] = {random(), random(), random(), random()}; memcpy(sb->device_uuid, r, 16); } + if (rfd >= 0) + close(rfd); sb->dev_roles[i] = __cpu_to_le16(info->disk.raid_disk); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/tests/07testreshape5 new/mdadm-3.0.2/tests/07testreshape5 --- old/mdadm-3.0/tests/07testreshape5 2009-03-02 02:39:10.000000000 +0100 +++ new/mdadm-3.0.2/tests/07testreshape5 2009-09-25 09:54:33.000000000 +0200 @@ -27,6 +27,7 @@ # test save dd if=/dev/urandom of=$md0 bs=1024 count=$size + blockdev --flushbufs $md0 $devs > /tmp/NewRand $dir/test_stripe save /tmp/NewRand $disks $[chunk*1024] 5 $nlayout 0 $[size*1024] $devs cmp -s -n $[size*1024] $md0 /tmp/NewRand || { echo cmp failed ; exit 2; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mdadm-3.0/util.c new/mdadm-3.0.2/util.c --- old/mdadm-3.0/util.c 2009-06-02 07:48:29.000000000 +0200 +++ new/mdadm-3.0.2/util.c 2009-09-25 09:54:33.000000000 +0200 @@ -863,6 +863,8 @@ return; usleep(200000); } + if (i == 25) + dprintf("%s: timeout waiting for %s\n", __func__, dev); } struct superswitch *superlist[] = { &super0, &super1, &super_ddf, &super_imsm, NULL }; @@ -1298,6 +1300,17 @@ return 0; } +__u32 random32(void) +{ + __u32 rv; + int rfd = open("/dev/urandom", O_RDONLY); + if (rfd < 0 || read(rfd, &rv, 4) != 4) + rv = random(); + if (rfd >= 0) + close(rfd); + return rv; +} + #ifndef MDASSEMBLE int flush_metadata_updates(struct supertype *st) { ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org