- Updated to latest upstream stable release (#466803)
- Change udev rule to not assemble degraded arrays (#453314) - Fix metadata matching in config file (#466078) - Fix assembly of raid10 devices (#444237) - Fix incremental assembly of partitioned raid devices (#447818)
This commit is contained in:
parent
a8863c5bdb
commit
7e22e636df
@ -9,3 +9,4 @@ mdadm-2.6.1.tgz
|
||||
mdadm-2.6.2.tgz
|
||||
mdadm-2.6.4.tgz
|
||||
mdadm-2.6.7.tar.bz2
|
||||
mdadm-2.6.7.1.tar.bz2
|
||||
|
@ -13,12 +13,3 @@
|
||||
|
||||
mdadm.tcc : $(SRCS) mdadm.h
|
||||
$(TCC) -o mdadm.tcc $(SRCS)
|
||||
@@ -113,7 +113,7 @@ mdassemble : $(ASSEMBLE_SRCS) mdadm.h
|
||||
|
||||
mdassemble.static : $(ASSEMBLE_SRCS) mdadm.h
|
||||
rm -f $(OBJS)
|
||||
- $(CC) $(LDFLAGS) $(ASSEMBLE_FLAGS) -static -DHAVE_STDINT_H -o mdassemble.static $(ASSEMBLE_SRCS) $(STATICSRC)
|
||||
+ $(CC) $(ASSEMBLE_FLAGS) $(LDFLAGS) -static -DHAVE_STDINT_H -o mdassemble.static $(ASSEMBLE_SRCS) $(STATICSRC)
|
||||
|
||||
mdassemble.uclibc : $(ASSEMBLE_SRCS) mdadm.h
|
||||
rm -f $(OJS)
|
||||
|
@ -32,7 +32,7 @@
|
||||
- rm -f $(OBJS)
|
||||
+mdassemble.static : $(ASSEMBLE_SRCS) $(STATICSRC) mdadm.h
|
||||
+ rm -f $(OBJS) $(STATICOBJS)
|
||||
$(CC) $(ASSEMBLE_FLAGS) $(LDFLAGS) -static -DHAVE_STDINT_H -o mdassemble.static $(ASSEMBLE_SRCS) $(STATICSRC)
|
||||
$(CC) $(LDFLAGS) $(ASSEMBLE_FLAGS) -static -DHAVE_STDINT_H -o mdassemble.static $(ASSEMBLE_SRCS) $(STATICSRC)
|
||||
|
||||
mdassemble.auto : $(ASSEMBLE_SRCS) mdadm.h $(ASSEMBLE_AUTO_SRCS)
|
||||
@@ -135,8 +137,8 @@ mdassemble.auto : $(ASSEMBLE_SRCS) mdadm
|
||||
|
82
mdadm-2.6.7.1-metadata.patch
Normal file
82
mdadm-2.6.7.1-metadata.patch
Normal file
@ -0,0 +1,82 @@
|
||||
commit ce1a9e3cfca9342080fe66a1352acd1671a49261
|
||||
Author: Doug Ledford <dledford@redhat.com>
|
||||
Date: Tue Oct 28 11:42:57 2008 -0400
|
||||
|
||||
Fix bad metadata formatting
|
||||
|
||||
Certain operations (Detail.c mainly) would print out the metadata of
|
||||
an array in a format that the scan operation in super0.c and super1.c
|
||||
would later reject as unknown when it was found in the mdadm.conf file.
|
||||
Use a consistent format, but also modify the super0 and super1 match
|
||||
methods to accept the other format without complaint.
|
||||
|
||||
Signed-off-by: Doug Ledford <dledford@redhat.com>
|
||||
|
||||
diff --git a/Detail.c b/Detail.c
|
||||
index ab2f84e..1937fbe 100644
|
||||
--- a/Detail.c
|
||||
+++ b/Detail.c
|
||||
@@ -138,7 +138,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
|
||||
if (sra && sra->array.major_version < 0)
|
||||
printf("MD_METADATA=%s\n", sra->text_version);
|
||||
else
|
||||
- printf("MD_METADATA=%02d.%02d\n",
|
||||
+ printf("MD_METADATA=%d.%02d\n",
|
||||
array.major_version, array.minor_version);
|
||||
|
||||
if (st && st->sb)
|
||||
@@ -153,7 +153,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
|
||||
if (sra && sra->array.major_version < 0)
|
||||
printf(" metadata=%s", sra->text_version);
|
||||
else
|
||||
- printf(" metadata=%02d.%02d",
|
||||
+ printf(" metadata=%d.%02d",
|
||||
array.major_version, array.minor_version);
|
||||
} else {
|
||||
mdu_bitmap_file_t bmf;
|
||||
@@ -175,7 +175,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
|
||||
if (sra && sra->array.major_version < 0)
|
||||
printf(" Version : %s\n", sra->text_version);
|
||||
else
|
||||
- printf(" Version : %02d.%02d\n",
|
||||
+ printf(" Version : %d.%02d\n",
|
||||
array.major_version, array.minor_version);
|
||||
|
||||
atime = array.ctime;
|
||||
diff --git a/super0.c b/super0.c
|
||||
index 7e81482..42d8659 100644
|
||||
--- a/super0.c
|
||||
+++ b/super0.c
|
||||
@@ -93,7 +93,7 @@ static void examine_super0(struct supertype *st, char *homehost)
|
||||
char *c;
|
||||
|
||||
printf(" Magic : %08x\n", sb->md_magic);
|
||||
- printf(" Version : %02d.%02d.%02d\n", sb->major_version, sb->minor_version,
|
||||
+ printf(" Version : %d.%02d.%02d\n", sb->major_version, sb->minor_version,
|
||||
sb->patch_version);
|
||||
if (sb->minor_version >= 90) {
|
||||
printf(" UUID : %08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
|
||||
@@ -847,6 +847,9 @@ static struct supertype *match_metadata_desc0(char *arg)
|
||||
st->minor_version = 90;
|
||||
st->max_devs = MD_SB_DISKS;
|
||||
st->sb = NULL;
|
||||
+ /* Eliminate pointless leading 0 from some versions of mdadm -D */
|
||||
+ if (strncmp(arg, "00.", 3) == 0)
|
||||
+ arg++;
|
||||
if (strcmp(arg, "0") == 0 ||
|
||||
strcmp(arg, "0.90") == 0 ||
|
||||
strcmp(arg, "0.91") == 0 ||
|
||||
diff --git a/super1.c b/super1.c
|
||||
index e1d0219..a81ee6f 100644
|
||||
--- a/super1.c
|
||||
+++ b/super1.c
|
||||
@@ -1186,6 +1186,9 @@ static struct supertype *match_metadata_desc1(char *arg)
|
||||
st->ss = &super1;
|
||||
st->max_devs = 384;
|
||||
st->sb = NULL;
|
||||
+ /* Eliminate pointless leading 0 from some versions of mdadm -D */
|
||||
+ if (strncmp(arg, "01.", 3) == 0)
|
||||
+ arg++;
|
||||
if (strcmp(arg, "1.0") == 0) {
|
||||
st->minor_version = 0;
|
||||
return st;
|
211
mdadm-2.6.7.1-partitionable.patch
Normal file
211
mdadm-2.6.7.1-partitionable.patch
Normal file
@ -0,0 +1,211 @@
|
||||
commit d3fbb3c40ab14707dde13cd297b7ac64d8c3109b
|
||||
Author: Doug Ledford <dledford@redhat.com>
|
||||
Date: Wed Oct 29 14:23:49 2008 -0400
|
||||
|
||||
Make incremental mode work with partitionable arrays
|
||||
|
||||
There were multiple problems with incremental mode and partitionable
|
||||
arrays. Change the logic to pay more attention to what it finds in
|
||||
mdadm.conf when setting up incremental arrays. Modify is_standard to
|
||||
differentiate between a required partitioned name format and an optionally
|
||||
partitioned named format. Modify open_mddev() to know about change to
|
||||
is_standard. Make Incremental differentiate between create default
|
||||
autof setting, command line autof setting, and array specific autof
|
||||
setting, with order of preference being command line, conf file, default.
|
||||
Disable the homehost test in the event there is no match for an array
|
||||
so we can hotplug new arrays into a running machine without them having
|
||||
to exist in mdadm.conf first (a random array number will be picked for
|
||||
the hot plugged array). Honor any name from mdadm.conf that matches the
|
||||
UUID of a device, not just standard names. Verify that the array name
|
||||
as matched in mdadm.conf allows the requested mode of operation and reject
|
||||
attempts to start non-partitionable arrays as partitioned and vice versa.
|
||||
|
||||
Signed-off-by: Doug Ledford <dledford@redhat.com>
|
||||
|
||||
diff --git a/Incremental.c b/Incremental.c
|
||||
index 9c6524f..806d192 100644
|
||||
--- a/Incremental.c
|
||||
+++ b/Incremental.c
|
||||
@@ -87,9 +87,6 @@ int Incremental(char *devname, int verbose, int runstop,
|
||||
|
||||
struct createinfo *ci = conf_get_create_info();
|
||||
|
||||
- if (autof == 0)
|
||||
- autof = ci->autof;
|
||||
-
|
||||
/* 1/ Check if devices is permitted by mdadm.conf */
|
||||
|
||||
if (!conf_test_dev(devname)) {
|
||||
@@ -204,6 +201,10 @@ int Incremental(char *devname, int verbose, int runstop,
|
||||
}
|
||||
|
||||
/* 3a/ if not, check for homehost match. If no match, reject. */
|
||||
+ /* We want to support hot plugged arrays that aren't listed in
|
||||
+ * /etc/mdadm.conf, so we need to skip the homehost test and allow
|
||||
+ * unmatched devices through so we can simply pick a random entry
|
||||
+ * to start them under
|
||||
if (!match) {
|
||||
if (homehost == NULL ||
|
||||
st->ss->match_home(st, homehost) == 0) {
|
||||
@@ -212,23 +213,128 @@ int Incremental(char *devname, int verbose, int runstop,
|
||||
": not found in mdadm.conf and not identified by homehost.\n");
|
||||
return 2;
|
||||
}
|
||||
- }
|
||||
+ } */
|
||||
/* 4/ Determine device number. */
|
||||
- /* - If in mdadm.conf with std name, use that */
|
||||
+ /* - If in mdadm.conf with any name, use that */
|
||||
/* - UUID in /var/run/mdadm.map use that */
|
||||
/* - If name is suggestive, use that. unless in use with */
|
||||
/* different uuid. */
|
||||
/* - Choose a free, high number. */
|
||||
/* - Use a partitioned device unless strong suggestion not to. */
|
||||
/* e.g. auto=md */
|
||||
- if (match && is_standard(match->devname, &devnum))
|
||||
- /* We have devnum now */;
|
||||
- else if ((mp = map_by_uuid(&map, info.uuid)) != NULL)
|
||||
+ if (match) {
|
||||
+ int use_partitions;
|
||||
+ if (autof != 0)
|
||||
+ /* command line overrides config file */
|
||||
+ match->autof = autof;
|
||||
+ else if (match->autof == 0)
|
||||
+ /* no specific autof setting in config for this */
|
||||
+ /* array, so use the ci->autof instead */
|
||||
+ match->autof = ci->autof;
|
||||
+ switch(is_standard(match->devname, &devnum)) {
|
||||
+ case 0: /* non-standard name */
|
||||
+ /* Need to find a free devnum to use */
|
||||
+ /* Need to know if we are supposed to be partitioned */
|
||||
+ /* or not to find a free devnum in the right major */
|
||||
+ switch(match->autof & 0x7) {
|
||||
+ case 3:
|
||||
+ case 5:
|
||||
+ autof = match->autof;
|
||||
+ case 0: /* this is what you get when you */
|
||||
+ /* don't specify anything, leave it */
|
||||
+ /* defaulting to non-partitioned for */
|
||||
+ /* back compatibility */
|
||||
+ use_partitions = 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ autof = match->autof;
|
||||
+ use_partitions = 1;
|
||||
+ }
|
||||
+ /* If we already have an assigned devnum find it */
|
||||
+ if ((mp = map_by_uuid(&map, info.uuid)) != NULL)
|
||||
+ devnum = mp->devnum;
|
||||
+ else
|
||||
+ devnum = find_free_devnum(use_partitions);
|
||||
+
|
||||
+ if (devnum == NoMdDev) {
|
||||
+ fprintf(stderr, Name
|
||||
+ ": No spare md devices!!\n");
|
||||
+ return 2;
|
||||
+ }
|
||||
+ break;
|
||||
+ case -1: /* standard, non-partitioned name */
|
||||
+ switch(match->autof & 0x7) {
|
||||
+ case 3:
|
||||
+ case 5:
|
||||
+ case 0:
|
||||
+ /* all good */
|
||||
+ use_partitions = 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* oops, attempting to set things to */
|
||||
+ /* an invalid state */
|
||||
+ fprintf(stderr, Name
|
||||
+ ": can't be a partitioned device by naming standards!!\n");
|
||||
+ return 2;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 1: /* standard, partitioned name */
|
||||
+ switch(match->autof & 0x7) {
|
||||
+ case 3:
|
||||
+ case 5:
|
||||
+ /* oops, attempting to set things to */
|
||||
+ /* an invalid state */
|
||||
+ fprintf(stderr, Name
|
||||
+ ": must be a partitioned device by naming standards!!\n");
|
||||
+ return 2;
|
||||
+ case 0:
|
||||
+ /* we haven't been told how many */
|
||||
+ /* partitions to make on either the */
|
||||
+ /* command line or the config file, */
|
||||
+ /* set to the default and enable */
|
||||
+ /* partitioned mode due to our name */
|
||||
+ autof = match->autof = (4 << 3) | 2;
|
||||
+ default:
|
||||
+ /* all good */
|
||||
+ use_partitions = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 2: /* may be either partitioned or not, devnum is set */
|
||||
+ switch(match->autof & 0x7) {
|
||||
+ case 0:
|
||||
+ /* not specified in any way, default to */
|
||||
+ /* unpartitioned for back compatibility */
|
||||
+ case 1:
|
||||
+ case 3:
|
||||
+ case 5:
|
||||
+ use_partitions = 0;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ /* partitioned, but we didn't get a number */
|
||||
+ /* of parititions, so use the default */
|
||||
+ match->autof = autof |= 4 << 3;
|
||||
+ case 4:
|
||||
+ case 6:
|
||||
+ /* the number of partitions is already in */
|
||||
+ /* autof */
|
||||
+ use_partitions = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ /* We have devnum now */
|
||||
+ if (use_partitions && devnum > 0)
|
||||
+ devnum = (-1-devnum);
|
||||
+ } else if ((mp = map_by_uuid(&map, info.uuid)) != NULL)
|
||||
devnum = mp->devnum;
|
||||
else {
|
||||
/* Have to guess a bit. */
|
||||
int use_partitions = 1;
|
||||
char *np, *ep;
|
||||
+
|
||||
+ if (autof == 0 && ci->autof)
|
||||
+ autof = ci->autof;
|
||||
if ((autof&7) == 3 || (autof&7) == 5)
|
||||
use_partitions = 0;
|
||||
np = strchr(info.name, ':');
|
||||
diff --git a/mdopen.c b/mdopen.c
|
||||
index 4fbcb48..4ba6fff 100644
|
||||
--- a/mdopen.c
|
||||
+++ b/mdopen.c
|
||||
@@ -147,8 +147,8 @@ int open_mddev(char *dev, int autof)
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
- case 3: /* create md, reject std>0 */
|
||||
- if (std > 0) {
|
||||
+ case 3: /* create md, reject std==1 */
|
||||
+ if (std == 1) {
|
||||
fprintf(stderr, Name ": that --auto option "
|
||||
"not compatable with device named %s\n", dev);
|
||||
return -1;
|
||||
diff --git a/util.c b/util.c
|
||||
index 75f3706..baa1690 100644
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -396,7 +396,7 @@ int is_standard(char *dev, int *nump)
|
||||
if (!d)
|
||||
return 0;
|
||||
if (strncmp(d, "/d",2)==0)
|
||||
- d += 2, type=1; /* /dev/md/dN{pM} */
|
||||
+ d += 2, type=2; /* /dev/md/dN{pM} */
|
||||
else if (strncmp(d, "/md_d", 5)==0)
|
||||
d += 5, type=1; /* /dev/md_dNpM */
|
||||
else if (strncmp(d, "/md", 3)==0)
|
42
mdadm-2.6.7.1-raid10-incremental.patch
Normal file
42
mdadm-2.6.7.1-raid10-incremental.patch
Normal file
@ -0,0 +1,42 @@
|
||||
commit fb26614d7a69d164f9e401f57389a1ca4e84258f
|
||||
Author: Doug Ledford <dledford@redhat.com>
|
||||
Date: Wed Oct 29 10:50:48 2008 -0400
|
||||
|
||||
Fix NULL pointer oops
|
||||
|
||||
RAID10 is the only raid level that uses the avail char array pointer
|
||||
during the enough() operation, so it was the only one that saw this.
|
||||
The code in incremental assumes unconditionally that count_active will
|
||||
allocate the avail char array, that it might be used by enough, and that
|
||||
it will need to be freed afterward. Once you make count_active actually
|
||||
do that, then the oops goes away.
|
||||
|
||||
Signed-off-by: Doug Ledford <dledford@redhat.com>
|
||||
|
||||
diff --git a/Incremental.c b/Incremental.c
|
||||
index 0fb9afd..9c6524f 100644
|
||||
--- a/Incremental.c
|
||||
+++ b/Incremental.c
|
||||
@@ -543,12 +543,18 @@ static int count_active(struct supertype *st, int mdfd, char **availp,
|
||||
if (ok != 0)
|
||||
continue;
|
||||
st->ss->getinfo_super(st, &info);
|
||||
+ if (!avail) {
|
||||
+ avail = malloc(info.array.raid_disks);
|
||||
+ if (!avail) {
|
||||
+ fprintf(stderr, Name ": out of memory.\n");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ memset(avail, 0, info.array.raid_disks);
|
||||
+ *availp = avail;
|
||||
+ }
|
||||
+
|
||||
if (info.disk.state & (1<<MD_DISK_SYNC))
|
||||
{
|
||||
- if (avail == NULL) {
|
||||
- avail = malloc(info.array.raid_disks);
|
||||
- memset(avail, 0, info.array.raid_disks);
|
||||
- }
|
||||
if (cnt == 0) {
|
||||
cnt++;
|
||||
max_events = info.events;
|
@ -3,4 +3,4 @@
|
||||
# See udev(8) for syntax
|
||||
|
||||
SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="linux_raid*", \
|
||||
RUN+="/sbin/mdadm --incremental --run --scan $root/%k"
|
||||
RUN+="/sbin/mdadm -I --auto=yes $root/%k"
|
||||
|
15
mdadm.spec
15
mdadm.spec
@ -1,6 +1,6 @@
|
||||
Summary: The mdadm program controls Linux md devices (software RAID arrays)
|
||||
Name: mdadm
|
||||
Version: 2.6.7
|
||||
Version: 2.6.7.1
|
||||
Release: 1%{?dist}
|
||||
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.bz2
|
||||
Source1: mdmonitor.init
|
||||
@ -11,6 +11,9 @@ Patch3: mdadm-2.2-nodiet.patch
|
||||
Patch4: mdadm-2.5.2-cflags.patch
|
||||
Patch5: mdadm-2.6.1-build.patch
|
||||
Patch6: mdadm-2.6.4-open.patch
|
||||
Patch7: mdadm-2.6.7.1-metadata.patch
|
||||
Patch8: mdadm-2.6.7.1-raid10-incremental.patch
|
||||
Patch9: mdadm-2.6.7.1-partitionable.patch
|
||||
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
|
||||
License: GPLv2+
|
||||
Group: System Environment/Base
|
||||
@ -35,6 +38,9 @@ file can be used to help with some common tasks.
|
||||
%patch4 -p1 -b .cflags
|
||||
%patch5 -p1 -b .build
|
||||
%patch6 -p1 -b .open
|
||||
%patch7 -p1 -b .metadata
|
||||
%patch8 -p1 -b .incremental
|
||||
%patch9 -p1 -b .partitionable
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" SYSCONFDIR="%{_sysconfdir}" MDASSEMBLE_AUTO=1 mdassemble.static mdassemble mdadm.static mdadm
|
||||
@ -85,6 +91,13 @@ fi
|
||||
%attr(0700,root,root) %dir /var/run/mdadm
|
||||
|
||||
%changelog
|
||||
* Fri Oct 24 2008 Doug Ledford <dledford@redhat.com> - 2.6.7.1-1
|
||||
- Updated to latest upstream stable release (#466803)
|
||||
- Change udev rule to not assemble degraded arrays (#453314)
|
||||
- Fix metadata matching in config file (#466078)
|
||||
- Fix assembly of raid10 devices (#444237)
|
||||
- Fix incremental assembly of partitioned raid devices (#447818)
|
||||
|
||||
* Thu Jun 26 2008 Doug Ledford <dledford@redhat.com> - 2.6.7-1
|
||||
- Update to latest upstream version (should resolve #444237)
|
||||
- Drop incremental patch as it's now part of upstream
|
||||
|
Loading…
Reference in New Issue
Block a user