- Update to latest upstream devel release

- Use the udev rules file included with mdadm instead of our own
- Drop all the no longer relevant patches
- Fix a build error in mdopen.c
- Fix the udev rules path in Makefile
This commit is contained in:
Doug Ledford 2009-02-12 15:40:59 +00:00
parent 7e3c782e9c
commit e48e5efc33
16 changed files with 65 additions and 607 deletions

View File

@ -10,3 +10,4 @@ mdadm-2.6.2.tgz
mdadm-2.6.4.tgz mdadm-2.6.4.tgz
mdadm-2.6.7.tar.bz2 mdadm-2.6.7.tar.bz2
mdadm-2.6.7.1.tar.bz2 mdadm-2.6.7.1.tar.bz2
mdadm-3.0-devel2.tar.bz2

View File

@ -1,12 +0,0 @@
diff -urN mdadm-2.2.orig/Makefile mdadm-2.2/Makefile
--- mdadm-2.2.orig/Makefile 2005-12-05 11:52:31.000000000 -0500
+++ mdadm-2.2/Makefile 2005-12-05 11:52:46.000000000 -0500
@@ -31,7 +31,7 @@
# e.g. make CXFLAGS=-O to optimise
TCC = tcc
UCLIBC_GCC = $(shell for nm in i386-uclibc-linux-gcc i386-uclibc-gcc; do which $$nm > /dev/null && { echo $$nm ; exit; } ; done; echo false No uclibc found )
-DIET_GCC = diet gcc
+DIET_GCC = gcc
KLIBC=/home/src/klibc/klibc-0.77

View File

@ -1,15 +0,0 @@
--- mdadm-2.5.2/Makefile.cflags 2006-07-07 15:00:32.000000000 -0400
+++ mdadm-2.5.2/Makefile 2006-07-07 15:02:09.000000000 -0400
@@ -89,10 +89,10 @@ everything: all mdadm.static mdadm.uclib
# mdadm.tcc doesn't work..
mdadm : $(OBJS)
- $(CC) $(LDFLAGS) -o mdadm $(OBJS) $(LDLIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o mdadm $(OBJS) $(LDLIBS)
mdadm.static : $(OBJS) $(STATICOBJS)
- $(CC) $(LDFLAGS) -static -o mdadm.static $(OBJS) $(STATICOBJS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -static -o mdadm.static $(OBJS) $(STATICOBJS)
mdadm.tcc : $(SRCS) mdadm.h
$(TCC) -o mdadm.tcc $(SRCS)

View File

@ -1,11 +0,0 @@
--- mdadm-2.5.2/Makefile.s390 2006-06-19 20:01:17.000000000 -0400
+++ mdadm-2.5.2/Makefile 2006-07-07 14:11:23.000000000 -0400
@@ -39,7 +39,7 @@ KLIBC_GCC = gcc -nostdinc -iwithprefix i
CC = $(CROSS_COMPILE)gcc
CXFLAGS = -ggdb
-CWFLAGS = -Wall -Werror -Wstrict-prototypes
+CWFLAGS = -Wall -Wstrict-prototypes
ifdef DEBIAN
CPPFLAGS= -DDEBIAN

View File

@ -1,36 +1,24 @@
--- mdadm-2.6.1/Makefile.static 2007-03-31 09:43:56.000000000 -0400 Binary files mdadm-3.0-devel2/mdadm.static and mdadm-3.0-devel2/mdadm differ
+++ mdadm-2.6.1/Makefile 2007-03-31 09:44:32.000000000 -0400 --- mdadm-3.0-devel2/Makefile.static 2009-02-12 09:58:36.000000000 -0500
@@ -146,23 +146,26 @@ $(OBJS) : mdadm.h bitmap.h +++ mdadm-3.0-devel2/Makefile 2009-02-12 09:59:22.000000000 -0500
sha1.o : sha1.c sha1.h md5.h @@ -183,16 +183,16 @@ sha1.o : sha1.c sha1.h md5.h
$(CC) $(CFLAGS) -DHAVE_STDINT_H -o sha1.o -c sha1.c $(INSTALL) -D $(STRIP) -m 755 mdmon $(DESTDIR)$(BINDIR)/mdmon
-install : mdadm install-man
- $(INSTALL) -D $(STRIP) -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm
+install : mdadm mdadm.static mdassemble.static install-man
+ $(INSTALL) -D -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm
+ $(INSTALL) -D -m 755 mdadm.static $(DESTDIR)$(BINDIR)/mdadm.static
+ $(INSTALL) -D -m 755 mdassemble.static $(DESTDIR)$(BINDIR)/mdassemble.static
install-static : mdadm.static install-man install-static : mdadm.static install-man
- $(INSTALL) -D $(STRIP) -m 755 mdadm.static $(DESTDIR)$(BINDIR)/mdadm - $(INSTALL) -D $(STRIP) -m 755 mdadm.static $(DESTDIR)$(BINDIR)/mdadm
+ $(INSTALL) -D -m 755 mdadm.static $(DESTDIR)$(BINDIR)/mdadm + $(INSTALL) -D $(STRIP) -m 755 mdadm.static $(DESTDIR)$(BINDIR)/mdadm.static
install-tcc : mdadm.tcc install-man install-tcc : mdadm.tcc install-man
- $(INSTALL) -D $(STRIP) -m 755 mdadm.tcc $(DESTDIR)$(BINDIR)/mdadm - $(INSTALL) -D $(STRIP) -m 755 mdadm.tcc $(DESTDIR)$(BINDIR)/mdadm
+ $(INSTALL) -D -m 755 mdadm.tcc $(DESTDIR)$(BINDIR)/mdadm + $(INSTALL) -D $(STRIP) -m 755 mdadm.tcc $(DESTDIR)$(BINDIR)/mdadm.tcc
install-uclibc : mdadm.uclibc install-man install-uclibc : mdadm.uclibc install-man
- $(INSTALL) -D $(STRIP) -m 755 mdadm.uclibc $(DESTDIR)$(BINDIR)/mdadm - $(INSTALL) -D $(STRIP) -m 755 mdadm.uclibc $(DESTDIR)$(BINDIR)/mdadm
+ $(INSTALL) -D -m 755 mdadm.uclibc $(DESTDIR)$(BINDIR)/mdadm + $(INSTALL) -D $(STRIP) -m 755 mdadm.uclibc $(DESTDIR)$(BINDIR)/mdadm.uclibc
install-klibc : mdadm.klibc install-man install-klibc : mdadm.klibc install-man
- $(INSTALL) -D $(STRIP) -m 755 mdadm.klibc $(DESTDIR)$(BINDIR)/mdadm - $(INSTALL) -D $(STRIP) -m 755 mdadm.klibc $(DESTDIR)$(BINDIR)/mdadm
+ $(INSTALL) -D -m 755 mdadm.klibc $(DESTDIR)$(BINDIR)/mdadm + $(INSTALL) -D $(STRIP) -m 755 mdadm.klibc $(DESTDIR)$(BINDIR)/mdadm.klibc
-install-man: mdadm.8 md.4 mdadm.conf.5 install-man: mdadm.8 md.4 mdadm.conf.5
+install-man: mdadm.8 mdassemble.8 md.4 mdadm.conf.5
$(INSTALL) -D -m 644 mdadm.8 $(DESTDIR)$(MAN8DIR)/mdadm.8 $(INSTALL) -D -m 644 mdadm.8 $(DESTDIR)$(MAN8DIR)/mdadm.8
+ $(INSTALL) -D -m 644 mdassemble.8 $(DESTDIR)$(MAN8DIR)/mdassemble.8
$(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
$(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5

View File

@ -1,74 +0,0 @@
--- mdadm-2.6.7/Makefile.build 2008-06-26 19:23:12.000000000 -0400
+++ mdadm-2.6.7/Makefile 2008-06-26 19:31:56.000000000 -0400
@@ -104,13 +104,15 @@ mdadm.static : $(OBJS) $(STATICOBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -static -o mdadm.static $(OBJS) $(STATICOBJS)
mdadm.tcc : $(SRCS) mdadm.h
+ rm -f $(OBJS) $(STATICOBJS)
$(TCC) -o mdadm.tcc $(SRCS)
dadm.uclibc : $(SRCS) mdadm.h
+ rm -f $(OBJS) $(STATICOBJS)
$(UCLIBC_GCC) -DUCLIBC -DHAVE_STDINT_H -o mdadm.uclibc $(SRCS) $(STATICSRC)
mdadm.klibc : $(SRCS) mdadm.h
- rm -f $(OBJS)
+ rm -f $(OBJS) $(STATICOBJS)
gcc -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32 $(CFLAGS) $(SRCS)
mdadm.Os : $(SRCS) mdadm.h
@@ -122,12 +124,12 @@ mdadm.O2 : $(SRCS) mdadm.h
test_stripe : restripe.c mdadm.h
$(CC) $(CXFLAGS) $(LDFLAGS) -o test_stripe -DMAIN restripe.c
-mdassemble : $(ASSEMBLE_SRCS) mdadm.h
- rm -f $(OBJS)
- $(DIET_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS) $(STATICSRC)
+mdassemble : $(ASSEMBLE_SRCS) $(STATICSRC) mdadm.h
+ rm -f $(OBJS) $(STATICOBJS)
+ $(CC) $(ASSEMBLE_FLAGS) $(LDFLAGS) -DHAVE_STDINT_H -o mdassemble $(ASSEMBLE_SRCS) $(STATICSRC)
-mdassemble.static : $(ASSEMBLE_SRCS) mdadm.h
- rm -f $(OBJS)
+mdassemble.static : $(ASSEMBLE_SRCS) $(STATICSRC) mdadm.h
+ rm -f $(OBJS) $(STATICOBJS)
$(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
$(MAKE) MDASSEMBLE_AUTO=1 mdassemble.static
mv mdassemble.static mdassemble.auto
-mdassemble.uclibc : $(ASSEMBLE_SRCS) mdadm.h
- rm -f $(OJS)
+mdassemble.uclibc : $(ASSEMBLE_SRCS) $(STATICSRC) mdadm.h
+ rm -f $(OJS) $(STATICOBJS)
$(UCLIBC_GCC) $(ASSEMBLE_FLAGS) -DUCLIBC -DHAVE_STDINT_H -static -o mdassemble.uclibc $(ASSEMBLE_SRCS) $(STATICSRC)
# This doesn't work
@@ -161,8 +163,9 @@ $(OBJS) : mdadm.h bitmap.h
sha1.o : sha1.c sha1.h md5.h
$(CC) $(CFLAGS) -DHAVE_STDINT_H -o sha1.o -c sha1.c
-install : mdadm mdadm.static mdassemble.static install-man
+install : mdadm mdadm.static mdassemble mdassemble.static install-man
$(INSTALL) -D -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm
+ $(INSTALL) -D -m 755 mdassemble $(DESTDIR)$(BINDIR)/mdassemble
$(INSTALL) -D -m 755 mdadm.static $(DESTDIR)$(BINDIR)/mdadm.static
$(INSTALL) -D -m 755 mdassemble.static $(DESTDIR)$(BINDIR)/mdassemble.static
@@ -179,10 +182,10 @@ install-klibc : mdadm.klibc install-man
$(INSTALL) -D -m 755 mdadm.klibc $(DESTDIR)$(BINDIR)/mdadm
install-man: mdadm.8 mdassemble.8 md.4 mdadm.conf.5
- $(INSTALL) -D -m 644 mdadm.8 $(DESTDIR)$(MAN8DIR)/mdadm.8
- $(INSTALL) -D -m 644 mdassemble.8 $(DESTDIR)$(MAN8DIR)/mdassemble.8
- $(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
- $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
+ $(INSTALL) -Dp -m 644 mdadm.8 $(DESTDIR)$(MAN8DIR)/mdadm.8
+ $(INSTALL) -Dp -m 644 mdassemble.8 $(DESTDIR)$(MAN8DIR)/mdassemble.8
+ $(INSTALL) -Dp -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
+ $(INSTALL) -Dp -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
uninstall:
rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 md.4 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm

View File

@ -1,35 +0,0 @@
diff -ru mdadm-2.6.4/mdopen.c mdadm-2.6.4-fixed/mdopen.c
--- mdadm-2.6.4/mdopen.c 2007-10-16 05:47:25.000000000 -0400
+++ mdadm-2.6.4-fixed/mdopen.c 2008-04-16 19:04:08.000000000 -0400
@@ -302,6 +302,7 @@
*/
int major_num, minor_num;
struct stat stb;
+ int i;
if (devname)
strcpy(chosen_name, devname);
@@ -333,11 +334,22 @@
return -1;
}
} else {
+ if (strncmp(chosen_name, "/dev/md/", 8) == 0) {
+ mkdir("/dev/md", 0755);
+ }
if (mknod(chosen_name, S_IFBLK | 0600,
makedev(major_num, minor_num)) != 0) {
return -1;
}
/* FIXME chown/chmod ?? */
}
- return open(chosen_name, O_RDWR);
+ for (i = 0; i < 25 ; i++) {
+ int fd;
+
+ fd = open(chosen_name, O_RDWR|O_EXCL);
+ if (fd >= 0)
+ return fd;
+ usleep(200000);
+ }
+ return -1;
}

View File

@ -1,95 +0,0 @@
--- mdadm-2.6.7/Create.c.open 2008-06-05 22:11:04.000000000 -0400
+++ mdadm-2.6.7/Create.c 2008-06-26 19:34:48.000000000 -0400
@@ -212,7 +212,7 @@ int Create(struct supertype *st, char *m
info.array.working_disks++;
if (dnum < raiddisks)
info.array.active_disks++;
- fd = open(dname, O_RDONLY|O_EXCL, 0);
+ fd = open(dname, O_RDONLY|O_EXCL);
if (fd <0 ) {
fprintf(stderr, Name ": Cannot open %s: %s\n",
dname, strerror(errno));
@@ -543,7 +543,7 @@ int Create(struct supertype *st, char *m
info.disk.minor = 0;
info.disk.state = (1<<MD_DISK_FAULTY);
} else {
- fd = open(dv->devname, O_RDONLY|O_EXCL, 0);
+ fd = open(dv->devname, O_RDONLY|O_EXCL);
if (fd < 0) {
fprintf(stderr, Name ": failed to open %s after earlier success - aborting\n",
dv->devname);
--- mdadm-2.6.7/mdassemble.c.open 2008-06-01 19:12:21.000000000 -0400
+++ mdadm-2.6.7/mdassemble.c 2008-06-26 19:33:42.000000000 -0400
@@ -57,7 +57,7 @@ mapping_t pers[] = {
/* from mdopen.c */
int open_mddev(char *dev, int autof/*unused */)
{
- int mdfd = open(dev, O_RDWR, 0);
+ int mdfd = open(dev, O_RDWR);
if (mdfd < 0)
fprintf(stderr, Name ": error opening %s: %s\n",
dev, strerror(errno));
--- mdadm-2.6.7/mdopen.c.open 2008-06-01 19:12:21.000000000 -0400
+++ mdadm-2.6.7/mdopen.c 2008-06-26 19:33:42.000000000 -0400
@@ -173,7 +173,7 @@ int open_mddev(char *dev, int autof)
must_remove = 1;
if (stb.st_mode && !must_remove) {
/* looks ok, see if it is available */
- mdfd = open(dev, O_RDWR, 0);
+ mdfd = open(dev, O_RDWR);
if (mdfd < 0) {
fprintf(stderr, Name ": error opening %s: %s\n",
dev, strerror(errno));
@@ -254,7 +254,7 @@ int open_mddev(char *dev, int autof)
make_parts(dev,parts, ci->symlinks);
}
}
- mdfd = open(dev, O_RDWR, 0);
+ mdfd = open(dev, O_RDWR);
if (mdfd < 0)
fprintf(stderr, Name ": error opening %s: %s\n",
dev, strerror(errno));
--- mdadm-2.6.7/Detail.c.open 2008-06-01 19:12:20.000000000 -0400
+++ mdadm-2.6.7/Detail.c 2008-06-26 19:33:42.000000000 -0400
@@ -38,7 +38,7 @@ int Detail(char *dev, int brief, int exp
* GET_ARRAY_INFO and GET_DISK_INFO ioctl calls
*/
- int fd = open(dev, O_RDONLY, 0);
+ int fd = open(dev, O_RDONLY);
int vers;
mdu_array_info_t array;
mdu_disk_info_t *disks;
--- mdadm-2.6.7/Grow.c.open 2008-06-01 19:12:20.000000000 -0400
+++ mdadm-2.6.7/Grow.c 2008-06-26 19:33:42.000000000 -0400
@@ -685,7 +685,7 @@ int Grow_reshape(char *devname, int fd,
}
spares = sra->array.spare_disks;
if (backup_file) {
- fdlist[d] = open(backup_file, O_RDWR|O_CREAT|O_EXCL, 0600);
+ fdlist[d] = open(backup_file, O_RDWR|O_CREAT|O_EXCL, S_IRUSR | S_IWUSR);
if (fdlist[d] < 0) {
fprintf(stderr, Name ": %s: cannot create backup file %s: %s\n",
devname, backup_file, strerror(errno));
--- mdadm-2.6.7/Query.c.open 2008-06-01 19:12:21.000000000 -0400
+++ mdadm-2.6.7/Query.c 2008-06-26 19:33:42.000000000 -0400
@@ -37,7 +37,7 @@ int Query(char *dev)
* whether it is an md device and whether it has
* a superblock
*/
- int fd = open(dev, O_RDONLY, 0);
+ int fd = open(dev, O_RDONLY);
int vers;
int ioctlerr;
int superror, superrno;
--- mdadm-2.6.7/Monitor.c.open 2008-06-01 19:12:21.000000000 -0400
+++ mdadm-2.6.7/Monitor.c 2008-06-26 19:33:42.000000000 -0400
@@ -156,7 +156,7 @@ int Monitor(mddev_dev_t devlist,
return 1;
}
close(0);
- open("/dev/null", 3);
+ open("/dev/null", O_RDWR);
dup2(0,1);
dup2(0,2);
setsid();

View File

@ -1,82 +0,0 @@
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;

View File

@ -1,211 +0,0 @@
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)

View File

@ -1,42 +0,0 @@
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;

28
mdadm-3.0-udev.patch Normal file
View File

@ -0,0 +1,28 @@
--- mdadm-3.0-devel2/Makefile.udev 2009-02-12 09:10:23.000000000 -0500
+++ mdadm-3.0-devel2/Makefile 2009-02-12 09:12:20.000000000 -0500
@@ -44,7 +44,7 @@ CC = $(CROSS_COMPILE)gcc
CXFLAGS = -ggdb
CWFLAGS = -Wall -Werror -Wstrict-prototypes
ifdef WARN_UNUSED
-CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O
+CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -Os
endif
ifdef DEBIAN
@@ -71,6 +71,7 @@ MANDIR = /usr/share/man
MAN4DIR = $(MANDIR)/man4
MAN5DIR = $(MANDIR)/man5
MAN8DIR = $(MANDIR)/man8
+UDEVDIR = /etc/udev/rules.d
OBJS = mdadm.o config.o mdstat.o ReadMe.o util.o Manage.o Assemble.o Build.o \
Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \
@@ -199,7 +200,7 @@ install-man: mdadm.8 md.4 mdadm.conf.5
$(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
install-udev: udev-md-raid.rules
- $(INSTALL) -D -m 644 udev-md-raid.rules /lib/udev/rules.d/64-md-raid.rules
+ $(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)$(UDEVDIR)/64-md-raid.rules
uninstall:
rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 md.4 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm

24
mdadm-3.0-warn.patch Normal file
View File

@ -0,0 +1,24 @@
--- mdadm-3.0-devel2/mdopen.c.warn 2009-02-12 09:13:54.000000000 -0500
+++ mdadm-3.0-devel2/mdopen.c 2009-02-12 09:34:15.000000000 -0500
@@ -88,8 +88,9 @@ void make_parts(char *dev, int cnt)
if (chmod(name, stb2.st_mode & 07777))
perror("chmod");
} else {
- snprintf(sym, 10000, "%s%s%d", orig, odig?"p":"", i);
- symlink(sym, name);
+ snprintf(sym, 1024, "%s%s%d", orig, odig?"p":"", i);
+ if (symlink(sym, name))
+ perror("symlink");
}
stat(name, &stb2);
add_dev(name, &stb2, 0, NULL);
@@ -357,7 +358,8 @@ int create_mddev(char *dev, char *name,
strcpy(chosen, devname);
}
} else
- symlink(devname, chosen);
+ if (symlink(devname, chosen))
+ perror("symlink");
if (use_mdp && strcmp(chosen, devname) != 0)
make_parts(chosen, parts);
}

View File

@ -1,6 +0,0 @@
# This file causes block devices with Linux RAID (mdadm) signatures to
# automatically cause mdadm to be run.
# See udev(8) for syntax
SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="linux_raid*", \
RUN+="/sbin/mdadm -I --auto=yes $root/%k"

View File

@ -30,7 +30,7 @@ file can be used to help with some common tasks.
%patch3 -p1 -b .static %patch3 -p1 -b .static
%build %build
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm.static mdadm mdmon make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS -fno-strict-alias" SYSCONFDIR="%{_sysconfdir}" mdadm.static mdadm mdmon
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT

View File

@ -1 +1 @@
9e8d4744985c8b7e92f748e743b7d2a3 mdadm-2.6.7.1.tar.bz2 3dec65da9f71d6ef9fbd2e8f06828703 mdadm-3.0-devel2.tar.bz2