- Grab latest upstream release instead of git repo snapshot (bz552344,

bz572561)
- The lack of /dev/md is causing problems, so add code to mapfile.c to
    cause us to create /dev/md if it doesn't exist (bz569019)
This commit is contained in:
Doug Ledford 2010-03-17 03:34:43 +00:00
parent fd9c51472d
commit 114a7df1cb
7 changed files with 59 additions and 180 deletions

View File

@ -1,2 +1,3 @@
mdadm-3.0.3.tar.bz2
mdadm-3.1.1-gcd9a8b5.tar.bz2
mdadm-3.1.2.tar.bz2

View File

@ -1,15 +1,15 @@
--- mdadm-3.1.1/Makefile.static 2010-02-08 01:26:18.000000000 -0500
+++ mdadm-3.1.1/Makefile 2010-02-17 13:52:42.928428188 -0500
--- mdadm-3.1.2/Makefile.static 2010-03-10 00:02:42.000000000 -0500
+++ mdadm-3.1.2/Makefile 2010-03-16 22:21:10.934378490 -0400
@@ -62,7 +62,7 @@ CONFFILEFLAGS = -DCONFFILE=\"$(CONFFILE)
# from early boot to late boot.
# If you don't have /lib/init/rw you might want to use /dev/.something
# e.g. make ALT_RUN=/dev/.mdadm
-ALT_RUN = /lib/init/rw
+ALT_RUN = /dev/md
VAR_RUN = /var/run
ALTFLAGS = -DALT_RUN=\"$(ALT_RUN)\"
CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(ALTFLAGS)
@@ -196,16 +196,16 @@ install : mdadm mdmon install-man instal
VARFLAGS = -DVAR_RUN=\"$(VAR_RUN)\"
@@ -205,16 +205,16 @@ install : mdadm mdmon install-man instal
$(INSTALL) -D $(STRIP) -m 755 mdmon $(DESTDIR)$(BINDIR)/mdmon
install-static : mdadm.static install-man

View File

@ -1,13 +0,0 @@
diff --git a/Assemble.c b/Assemble.c
index e4d6181..23cc438 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -434,7 +434,7 @@ int Assemble(struct supertype *st, char *mddev,
}
}
st = tst; tst = NULL;
- if (!auto_assem && tmpdev->next != NULL) {
+ if (!auto_assem && inargv && tmpdev->next != NULL) {
fprintf(stderr, Name ": %s is a container, but is not "
"only device given: confused and aborting\n",
devname);

View File

@ -1,152 +0,0 @@
--- mdadm-3.1.1/Grow.c.warn 2010-02-08 01:26:18.000000000 -0500
+++ mdadm-3.1.1/Grow.c 2010-02-17 14:58:43.615427833 -0500
@@ -1096,7 +1096,7 @@ int Grow_reshape(char *devname, int fd,
/* set them all just in case some old 'new_*' value
* persists from some earlier problem
*/
- int err;
+ int err = 0;
if (sysfs_set_num(sra, NULL, "chunk_size", nchunk) < 0)
rv = 1, err = errno;
if (!rv && sysfs_set_num(sra, NULL, "layout", nlayout) < 0)
@@ -1269,6 +1269,7 @@ int grow_backup(struct mdinfo *sra,
int odata = disks;
int rv = 0;
int i;
+ int ret;
unsigned long long new_degraded;
//printf("offset %llu\n", offset);
if (level >= 4)
@@ -1334,10 +1335,10 @@ int grow_backup(struct mdinfo *sra,
((char*)&bsb.sb_csum2)-((char*)&bsb));
lseek64(destfd[i], destoffsets[i] - 4096, 0);
- write(destfd[i], &bsb, 512);
+ ret = write(destfd[i], &bsb, 512);
if (destoffsets[i] > 4096) {
lseek64(destfd[i], destoffsets[i]+stripes*chunk*odata, 0);
- write(destfd[i], &bsb, 512);
+ ret = write(destfd[i], &bsb, 512);
}
fsync(destfd[i]);
}
@@ -1368,6 +1369,7 @@ int wait_backup(struct mdinfo *sra,
int fd = sysfs_get_fd(sra, NULL, "sync_completed");
unsigned long long completed;
int i;
+ int ret;
if (fd < 0)
return -1;
@@ -1406,7 +1408,7 @@ int wait_backup(struct mdinfo *sra,
bsb.sb_csum2 = bsb_csum((char*)&bsb,
((char*)&bsb.sb_csum2)-((char*)&bsb));
lseek64(destfd[i], destoffsets[i]-4096, 0);
- write(destfd[i], &bsb, 512);
+ ret = write(destfd[i], &bsb, 512);
fsync(destfd[i]);
}
return 0;
@@ -1414,8 +1416,9 @@ int wait_backup(struct mdinfo *sra,
static void fail(char *msg)
{
- write(2, msg, strlen(msg));
- write(2, "\n", 1);
+ int ret;
+ ret = write(2, msg, strlen(msg));
+ ret = write(2, "\n", 1);
exit(1);
}
@@ -1452,8 +1455,10 @@ static void validate(int afd, int bfd, u
free(abuf);
free(bbuf);
abuflen = len;
- posix_memalign((void**)&abuf, 4096, abuflen);
- posix_memalign((void**)&bbuf, 4096, abuflen);
+ if (posix_memalign((void**)&abuf, 4096, abuflen) != 0)
+ fail("unable to allocate aligned memory");
+ if (posix_memalign((void**)&bbuf, 4096, abuflen) != 0)
+ fail("unable to allocate aligned memory");
}
lseek64(bfd, offset, 0);
@@ -1486,7 +1491,11 @@ static void validate(int afd, int bfd, u
free(bbuf);
abuflen = len;
abuf = malloc(abuflen);
+ if (abuf == NULL)
+ fail("unable to allocate memory");
bbuf = malloc(abuflen);
+ if (bbuf == NULL)
+ fail("unable to allocate memory");
}
lseek64(bfd, offset+__le64_to_cpu(bsb2.devstart2)*512, 0);
@@ -1508,7 +1517,8 @@ static int child_grow(int afd, struct md
char *buf;
int degraded = 0;
- posix_memalign((void**)&buf, 4096, disks * chunk);
+ if (posix_memalign((void**)&buf, 4096, disks * chunk) != 0)
+ fail("unable to allocate aligned memory");
sysfs_set_num(sra, NULL, "suspend_hi", 0);
sysfs_set_num(sra, NULL, "suspend_lo", 0);
grow_backup(sra, 0, stripes,
@@ -1536,7 +1546,8 @@ static int child_shrink(int afd, struct
int rv;
int degraded = 0;
- posix_memalign((void**)&buf, 4096, disks * chunk);
+ if (posix_memalign((void**)&buf, 4096, disks * chunk) != 0)
+ fail("unable to allocate alinged memory");
start = sra->component_size - stripes * chunk/512;
sysfs_set_num(sra, NULL, "sync_max", start);
sysfs_set_str(sra, NULL, "sync_action", "reshape");
@@ -1575,7 +1586,8 @@ static int child_same_size(int afd, stru
int degraded = 0;
- posix_memalign((void**)&buf, 4096, disks * chunk);
+ if (posix_memalign((void**)&buf, 4096, disks * chunk) != 0)
+ fail("unable to allocate alinged memory");
sysfs_set_num(sra, NULL, "suspend_lo", 0);
sysfs_set_num(sra, NULL, "suspend_hi", 0);
--- mdadm-3.1.1/restripe.c.warn 2010-02-08 01:26:18.000000000 -0500
+++ mdadm-3.1.1/restripe.c 2010-02-17 14:58:43.615427833 -0500
@@ -565,7 +565,10 @@ int restore_stripes(int *dest, unsigned
int data_disks = raid_disks - (level == 0 ? 0 : level <= 5 ? 1 : 2);
- posix_memalign((void**)&stripe_buf, 4096, raid_disks * chunk_size);
+ if (posix_memalign((void**)&stripe_buf, 4096, raid_disks * chunk_size) != 0) {
+ fprintf(stderr, "unable to allocate aligned memory\n");
+ exit(1);
+ }
if (zero == NULL) {
zero = malloc(chunk_size);
if (zero)
--- mdadm-3.1.1/mdmon.c.warn 2010-02-08 01:26:18.000000000 -0500
+++ mdadm-3.1.1/mdmon.c 2010-02-17 14:58:43.616427642 -0500
@@ -176,7 +176,7 @@ static void try_kill_monitor(pid_t pid,
fl = fcntl(sock, F_GETFL, 0);
fl &= ~O_NONBLOCK;
fcntl(sock, F_SETFL, fl);
- read(sock, buf, 100);
+ n = read(sock, buf, 100);
}
void remove_pidfile(char *devname)
--- mdadm-3.1.1/super-intel.c.warn 2010-02-17 14:59:16.757425375 -0500
+++ mdadm-3.1.1/super-intel.c 2010-02-17 15:00:15.309803578 -0500
@@ -698,7 +698,7 @@ static void print_imsm_dev(struct imsm_d
printf(" <-- %s", map_state_str[map->map_state]);
printf("\n Checkpoint : %u (%llu)",
__le32_to_cpu(dev->vol.curr_migr_unit),
- blocks_per_migr_unit(dev));
+ (unsigned long long)blocks_per_migr_unit(dev));
}
printf("\n");
printf(" Dirty State : %s\n", dev->vol.dirty ? "dirty" : "clean");

40
mdadm-3.1.2-mapfile.patch Normal file
View File

@ -0,0 +1,40 @@
commit b25462c1bee1a01c6aae3c215e040bfb2f1c2fb7
Author: Doug Ledford <dledford@redhat.com>
Date: Tue Mar 16 23:00:11 2010 -0400
Create /dev/md in mapfile open like we do in mdopen if our ALT_RUN is
set to be /dev/md. This keeps udev happy as it won't have to special
case our /dev/md directory needs.
Signed-off-by: Doug Ledford <dledford@redhat.com>
diff --git a/mapfile.c b/mapfile.c
index 366ebe3..eed17c8 100644
--- a/mapfile.c
+++ b/mapfile.c
@@ -29,7 +29,7 @@
*/
/* /var/run/mdadm.map is used to track arrays being created in --incremental
- * more. It particularly allows lookup from UUID to array device, but
+ * mode. It particularly allows lookup from UUID to array device, but
* also allows the array device name to be easily found.
*
* The map file is line based with space separated fields. The fields are:
@@ -64,6 +64,16 @@ char *mapsmode[3] = { "r", "w", "w"};
FILE *open_map(int modenum, int *choice)
{
int i;
+ struct stat sbuf;
+
+ /* Special case...if ALT_RUN is selected to be /dev/md, then
+ * because we would normally create /dev/md ourselves in order to
+ * stuff array symlinks in there as needed, udev and friends
+ * expect us to create our own tree. So, do so.
+ */
+ if (strcmp(ALT_RUN, "/dev/md") == 0 && stat(ALT_RUN, &sbuf) != 0)
+ mkdir(ALT_RUN, 0755);
+
for (i = 0 ; i < 3 ; i++) {
int fd = open(mapname[i][modenum], mapmode[modenum], 0600);
if (fd >= 0) {

View File

@ -1,16 +1,15 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm
Version: 3.1.1
Release: 0.gcd9a8b5.6%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}-gcd9a8b5.tar.bz2
Version: 3.1.2
Release: 1%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.bz2
Source1: mdmonitor.init
Source2: raid-check
Source3: mdadm.rules
Source4: mdadm-raid-check-sysconfig
Patch1: mdadm-2.5.2-static.patch
Patch2: mdadm-3.1.1-warn.patch
Patch3: mdadm-3.1.1-endian.patch
Patch4: mdadm-3.1.1-imsm.patch
Patch2: mdadm-3.1.1-endian.patch
Patch3: mdadm-3.1.2-mapfile.patch
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
License: GPLv2+
Group: System Environment/Base
@ -32,9 +31,8 @@ file can be used to help with some common tasks.
%prep
%setup -q
%patch1 -p1 -b .static
%patch2 -p1 -b .warn
%patch3 -p1 -b .endian
%patch4 -p1 -b .imsm
%patch2 -p1 -b .endian
%patch3 -p1 -b .mapfile
%build
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" SYSCONFDIR="%{_sysconfdir}" mdadm.static mdadm mdmon
@ -81,6 +79,11 @@ fi
%attr(0700,root,root) %dir /var/run/mdadm
%changelog
* Tue Mar 16 2010 Doug Ledford <dledford@redhat.com> - 3.1.2-1
- Grab latest upstream release instead of git repo snapshot (bz552344, bz572561)
- The lack of /dev/md is causing problems, so add code to mapfile.c to cause
us to create /dev/md if it doesn't exist (bz569019)
* Tue Feb 23 2010 Doug Ledford <dledford@redhat.com> - 3.1.1-0.gcd9a8b5.6
- Newer version of imsm patch that leaves warning, but only when there
actually are too many devices on the command line (bz554974)

View File

@ -1 +1 @@
fd4bcda48d6dc3d6113b5c25950c9671 mdadm-3.1.1-gcd9a8b5.tar.bz2
c5a39f38c465229767a5af2a4eb81bef mdadm-3.1.2.tar.bz2