- Fix s390/ppc64 UUID byte swap issue

This commit is contained in:
Doug Ledford 2010-02-18 18:02:36 +00:00
parent 46ccebf6f3
commit 25ef040df7
11 changed files with 193 additions and 182 deletions

View File

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

View File

@ -1,7 +1,15 @@
Binary files mdadm-3.0-devel2/mdadm.static and mdadm-3.0-devel2/mdadm differ
--- mdadm-3.0-devel2/Makefile.static 2009-02-12 09:58:36.000000000 -0500
+++ mdadm-3.0-devel2/Makefile 2009-02-12 09:59:22.000000000 -0500
@@ -183,16 +183,16 @@ sha1.o : sha1.c sha1.h md5.h
--- 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
@@ -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
ALTFLAGS = -DALT_RUN=\"$(ALT_RUN)\"
CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(ALTFLAGS)
@@ -196,16 +196,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,81 +0,0 @@
--- mdadm-3.0.3/mdmon.c.mdmon 2009-10-21 20:13:13.000000000 -0400
+++ mdadm-3.0.3/mdmon.c 2009-11-04 13:00:26.924089288 -0500
@@ -118,7 +118,7 @@ static int test_pidfile(char *devname)
char path[100];
struct stat st;
- sprintf(path, "/var/run/mdadm/%s.pid", devname);
+ sprintf(path, "/dev/.mdadm/%s.pid", devname);
return stat(path, &st);
}
@@ -132,7 +132,7 @@ int make_pidfile(char *devname, int o_ex
if (sigterm)
return -1;
- sprintf(path, "/var/run/mdadm/%s.pid", devname);
+ sprintf(path, "/dev/.mdadm/%s.pid", devname);
fd = open(path, O_RDWR|O_CREAT|o_excl, 0600);
if (fd < 0)
@@ -163,7 +163,7 @@ pid_t devname2mdmon(char *devname)
pid_t pid = -1;
int fd;
- sprintf(buf, "/var/run/mdadm/%s.pid", devname);
+ sprintf(buf, "/dev/.mdadm/%s.pid", devname);
fd = open(buf, O_RDONLY|O_NOATIME);
if (fd < 0)
return -1;
@@ -217,9 +217,9 @@ void remove_pidfile(char *devname)
if (sigterm)
return;
- sprintf(buf, "/var/run/mdadm/%s.pid", devname);
+ sprintf(buf, "/dev/.mdadm/%s.pid", devname);
unlink(buf);
- sprintf(buf, "/var/run/mdadm/%s.sock", devname);
+ sprintf(buf, "/dev/.mdadm/%s.sock", devname);
unlink(buf);
}
@@ -233,7 +233,7 @@ int make_control_sock(char *devname)
if (sigterm)
return -1;
- sprintf(path, "/var/run/mdadm/%s.sock", devname);
+ sprintf(path, "/dev/.mdadm/%s.sock", devname);
unlink(path);
sfd = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sfd < 0)
--- mdadm-3.0.3/msg.c.mdmon 2009-10-21 20:13:13.000000000 -0400
+++ mdadm-3.0.3/msg.c 2009-11-04 12:12:46.281963910 -0500
@@ -147,7 +147,7 @@ int connect_monitor(char *devname)
int pos;
char *c;
- pos = sprintf(path, "/var/run/mdadm/");
+ pos = sprintf(path, "/dev/.mdadm/");
if (is_subarray(devname)) {
devname++;
c = strchr(devname, '/');
--- mdadm-3.0.3/util.c.mdmon 2009-10-21 21:07:14.000000000 -0400
+++ mdadm-3.0.3/util.c 2009-11-04 12:12:46.282963942 -0500
@@ -1208,7 +1208,7 @@ int mdmon_running(int devnum)
char pid[10];
int fd;
int n;
- sprintf(path, "/var/run/mdadm/%s.pid", devnum2devname(devnum));
+ sprintf(path, "/dev/.mdadm/%s.pid", devnum2devname(devnum));
fd = open(path, O_RDONLY, 0);
if (fd < 0)
@@ -1228,7 +1228,7 @@ int signal_mdmon(int devnum)
char pid[10];
int fd;
int n;
- sprintf(path, "/var/run/mdadm/%s.pid", devnum2devname(devnum));
+ sprintf(path, "/dev/.mdadm/%s.pid", devnum2devname(devnum));
fd = open(path, O_RDONLY, 0);
if (fd < 0)

View File

@ -1,29 +0,0 @@
--- mdadm-3.0/Detail.c.metadata 2009-09-11 02:10:24.000000000 -0400
+++ mdadm-3.0/Detail.c 2009-09-15 14:54:56.849391192 -0400
@@ -161,7 +161,7 @@
if (sra && sra->array.major_version < 0)
printf("MD_METADATA=%s\n", sra->text_version);
else
- printf("MD_METADATA=%d.%02d\n",
+ printf("MD_METADATA=%d.%d\n",
array.major_version, array.minor_version);
}
@@ -208,7 +208,7 @@
if (sra && sra->array.major_version < 0)
printf(" metadata=%s", sra->text_version);
else
- printf(" metadata=%d.%02d",
+ printf(" metadata=%d.%d",
array.major_version, array.minor_version);
}
@@ -241,7 +241,7 @@
if (sra && sra->array.major_version < 0)
printf(" Version : %s\n", sra->text_version);
else
- printf(" Version : %d.%02d\n",
+ printf(" Version : %d.%d\n",
array.major_version, array.minor_version);
}

View File

@ -1,15 +0,0 @@
diff -up mdadm-3.0/Detail.c~ mdadm-3.0/Detail.c
--- mdadm-3.0/Detail.c~ 2009-06-02 07:48:29.000000000 +0200
+++ mdadm-3.0/Detail.c 2009-09-14 17:11:15.000000000 +0200
@@ -185,6 +185,11 @@ int Detail(char *dev, int brief, int exp
if (mp && mp->path &&
strncmp(mp->path, "/dev/md/", 8) == 0)
printf("MD_DEVNAME=%s\n", mp->path+8);
+ if (mp && (mp->uuid[0] || mp->uuid[1] || mp->uuid[2] ||
+ mp->uuid[3]))
+ printf("MD_UUID=%08x:%08x:%08x:%08x\n",
+ mp->uuid[0], mp->uuid[1], mp->uuid[2],
+ mp->uuid[3]);
}
goto out;
}

View File

@ -1,25 +0,0 @@
--- mdadm-3.0.3/config.c 2009-10-01 02:57:03.000000000 -0400
+++ mdadm-3.0.3/config.c 2010-01-04 11:24:58.700853405 -0500
@@ -677,12 +677,21 @@
static char *auto_options = NULL;
void autoline(char *line)
{
+ char *w;
+
if (auto_options) {
fprintf(stderr, Name ": AUTO line may only be give once."
" Subsequent lines ignored\n");
return;
}
- auto_options = line;
+
+ auto_options = dl_strdup(line);
+ dl_init(auto_options);
+
+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
+ char *w2 = dl_strdup(w);
+ dl_add(auto_options, w2);
+ }
}
int loaded = 0;

View File

@ -1,14 +0,0 @@
--- mdadm-3.0.3/super-intel.c.serial 2009-10-21 20:13:13.000000000 -0400
+++ mdadm-3.0.3/super-intel.c 2009-11-05 16:07:28.896089680 -0500
@@ -2987,7 +2987,10 @@ static int add_to_super_imsm(struct supe
dd->fd = fd;
dd->e = NULL;
rv = imsm_read_serial(fd, devname, dd->serial);
- if (rv) {
+ if (rv && check_env("IMSM_DEVNAME_AS_SERIAL")) {
+ memset(dd->serial, 0, MAX_RAID_SERIAL_LEN);
+ fd2devname(fd, (char *) dd->serial);
+ } else if (rv) {
fprintf(stderr,
Name ": failed to retrieve scsi serial, aborting\n");
free(dd);

13
mdadm-3.1.1-endian.patch Normal file
View File

@ -0,0 +1,13 @@
--- mdadm-3.1.1/super1.c.endian 2010-02-18 01:39:56.079803165 -0500
+++ mdadm-3.1.1/super1.c 2010-02-18 01:40:07.973803550 -0500
@@ -1667,10 +1667,6 @@ struct superswitch super1 = {
.locate_bitmap = locate_bitmap1,
.write_bitmap = write_bitmap1,
.free_super = free_super1,
-#if __BYTE_ORDER == BIG_ENDIAN
- .swapuuid = 0,
-#else
.swapuuid = 1,
-#endif
.name = "1.x",
};

152
mdadm-3.1.1-warn.patch Normal file
View File

@ -0,0 +1,152 @@
--- 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");

View File

@ -1,18 +1,15 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm
Version: 3.0.3
Release: 3%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.bz2
Version: 3.1.1
Release: 0.gcd9a8b5.2%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}-gcd9a8b5.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.0-metadata.patch
Patch3: mdadm-3.0-uuid.patch
Patch4: mdadm-3.0-mdmon-dev-.mdadm.patch
Patch5: mdadm-3.0.3-intel-serial.patch
Patch6: mdadm-3.0.3-auto.patch
Patch2: mdadm-3.1.1-warn.patch
Patch3: mdadm-3.1.1-endian.patch
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
License: GPLv2+
Group: System Environment/Base
@ -34,11 +31,8 @@ file can be used to help with some common tasks.
%prep
%setup -q
%patch1 -p1 -b .static
%patch2 -p1 -b .metadata
%patch3 -p1 -b .uuid
%patch4 -p1 -b .mdmon
%patch5 -p1 -b .serial
%patch6 -p1 -b .auto
%patch2 -p1 -b .warn
%patch3 -p1 -b .endian
%build
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" SYSCONFDIR="%{_sysconfdir}" mdadm.static mdadm mdmon
@ -85,6 +79,13 @@ fi
%attr(0700,root,root) %dir /var/run/mdadm
%changelog
* Thu Feb 18 2010 Doug Ledford <dledford@redhat.com> - 3.1.1-0.gcd9a8b5.2
- Fix s390/ppc64 UUID byte swap issue
* Wed Feb 17 2010 Doug Ledford <dledford@redhat.com> - 3.1.1-0.gcd9a8b5.1
- Update to head of upstream git repo, which contains a significant number
of bug fixes we need
* Fri Jan 15 2010 Doug Ledford <dledford@redhat.com> - 3.0.3-3
- Fix crash when AUTO keyword is in mdadm.conf (bz552342)

View File

@ -1 +1 @@
1ab786dee6c65c68ea74199788bf88c7 mdadm-3.0.3.tar.bz2
fd4bcda48d6dc3d6113b5c25950c9671 mdadm-3.1.1-gcd9a8b5.tar.bz2