- New upstream release 3.0.2

- Add a patch fixing mdadm --detail -export segfaults (bz526761, bz523862)
- Add a patch making mdmon store its state under /dev/.mdadm for initrd
    mdmon, rootfs mdmon handover
- Restart mdmon from initscript (when running) for rootfs mdmon handover
This commit is contained in:
Hans de Goede 2009-10-02 19:36:57 +00:00
parent c261edab2b
commit fa5ca2339d
7 changed files with 158 additions and 34 deletions

View File

@ -1,16 +1 @@
mdmpd-0.4.tgz mdadm-3.0.2.tar.bz2
mdadm-2.2.tar.bz2
mdadm-2.3.1.tgz
mdadm-2.5.2.tar.bz2
mdadm-2.5.3.tar.bz2
mdadm-2.5.4.tgz
mdadm-2.6.tgz
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
mdadm-3.0-devel2.tar.bz2
mdadm-3.0-devel3.tar.bz2
mdadm-3.0.tar.bz2
mdadm-3.0-0.20090915git.tar.bz2

View File

@ -1,12 +0,0 @@
diff -up mdadm-3.0/mdmon.c~ mdadm-3.0/mdmon.c
--- mdadm-3.0/mdmon.c~ 2009-09-11 08:10:24.000000000 +0200
+++ mdadm-3.0/mdmon.c 2009-09-16 22:42:21.000000000 +0200
@@ -395,7 +395,7 @@ int mdmon(char *devname, int devnum, int
} else
pfd[0] = pfd[1] = -1;
- container = malloc(sizeof(*container));
+ container = calloc(1, sizeof(*container));
container->devnum = devnum;
container->devname = devname;
container->arrays = NULL;

View File

@ -0,0 +1,90 @@
diff -up mdadm-3.0/mdmon.c~ mdadm-3.0/mdmon.c
--- mdadm-3.0/mdmon.c~ 2009-09-19 14:22:23.000000000 +0200
+++ mdadm-3.0/mdmon.c 2009-09-19 14:22:23.000000000 +0200
@@ -124,7 +124,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)
@@ -157,7 +157,7 @@ static void try_kill_monitor(char *devna
pid_t pid;
struct mdstat_ent *mdstat;
- sprintf(buf, "/var/run/mdadm/%s.pid", devname);
+ sprintf(buf, "/dev/.mdadm/%s.pid", devname);
fd = open(buf, O_RDONLY);
if (fd < 0)
return;
@@ -207,9 +207,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);
}
@@ -223,7 +223,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)
@@ -478,11 +478,10 @@ int mdmon(char *devname, int devnum, int
}
/* If this fails, we hope it already exists
- * pid file lives in /var/run/mdadm/mdXX.pid
+ * pid file lives in /dev/.mdadm/mdXX.pid
*/
- mkdir("/var", 0600);
- mkdir("/var/run", 0600);
- mkdir("/var/run/mdadm", 0600);
+ mkdir("/dev", 0700);
+ mkdir("/dev/.mdadm", 0700);
ignore = chdir("/");
if (make_pidfile(container->devname, O_EXCL) < 0) {
if (ping_monitor(container->devname) == 0) {
diff -up mdadm-3.0/msg.c~ mdadm-3.0/msg.c
--- mdadm-3.0/msg.c~ 2009-09-11 08:10:24.000000000 +0200
+++ mdadm-3.0/msg.c 2009-09-19 15:31:27.000000000 +0200
@@ -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, '/');
diff -up mdadm-3.0/util.c~ mdadm-3.0/util.c
--- mdadm-3.0/util.c~ 2009-09-19 14:22:23.000000000 +0200
+++ mdadm-3.0/util.c 2009-09-19 15:32:22.000000000 +0200
@@ -1206,7 +1206,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)
@@ -1226,7 +1226,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)

46
mdadm-3.0-rh526761.patch Normal file
View File

@ -0,0 +1,46 @@
From: NeilBrown <neilb@suse.de>
Date: Thu, 1 Oct 2009 02:51:04 +0000 (+1000)
Subject: Fix null-dereference in set_member_info
X-Git-Url: http://neil.brown.name/git?p=mdadm;a=commitdiff_plain;h=2b9aa337af7291d3f141322da96c9f667c99d53c
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>
---
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';

View File

@ -1,8 +1,8 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays) Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm Name: mdadm
Version: 3.0 Version: 3.0.2
Release: 4%{?dist} Release: 1%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}-0.20090915git.tar.bz2 Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.bz2
Source1: mdmonitor.init Source1: mdmonitor.init
Source2: raid-check Source2: raid-check
Source3: mdadm.rules Source3: mdadm.rules
@ -11,7 +11,8 @@ Patch1: mdadm-2.5.2-static.patch
Patch2: mdadm-3.0-endian-FAIL.patch Patch2: mdadm-3.0-endian-FAIL.patch
Patch3: mdadm-3.0-metadata.patch Patch3: mdadm-3.0-metadata.patch
Patch4: mdadm-3.0-uuid.patch Patch4: mdadm-3.0-uuid.patch
Patch5: mdadm-3.0-calloc.patch Patch5: mdadm-3.0-mdmon-dev-.mdadm.patch
Patch6: mdadm-3.0-rh526761.patch
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
License: GPLv2+ License: GPLv2+
Group: System Environment/Base Group: System Environment/Base
@ -36,7 +37,8 @@ file can be used to help with some common tasks.
%patch2 -p1 -b .endian %patch2 -p1 -b .endian
%patch3 -p1 -b .metadata %patch3 -p1 -b .metadata
%patch4 -p1 -b .uuid %patch4 -p1 -b .uuid
%patch5 -p1 -b .calloc %patch5 -p1 -b .mdmon
%patch6 -p1 -b .rh526761
%build %build
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" SYSCONFDIR="%{_sysconfdir}" mdadm.static mdadm mdmon make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" SYSCONFDIR="%{_sysconfdir}" mdadm.static mdadm mdmon
@ -82,6 +84,13 @@ fi
%attr(0700,root,root) %dir /var/run/mdadm %attr(0700,root,root) %dir /var/run/mdadm
%changelog %changelog
* Fri Oct 2 2009 Hans de Goede <hdegoede@redhat.com> - 3.0.2-1
- New upstream release 3.0.2
- Add a patch fixing mdadm --detail -export segfaults (bz526761, bz523862)
- Add a patch making mdmon store its state under /dev/.mdadm for initrd
mdmon, rootfs mdmon handover
- Restart mdmon from initscript (when running) for rootfs mdmon handover
* Thu Sep 17 2009 Doug Ledford <dledford@redhat.com> - 3.0-4 * Thu Sep 17 2009 Doug Ledford <dledford@redhat.com> - 3.0-4
- Stop some mdmon segfaults (bz523860) - Stop some mdmon segfaults (bz523860)

View File

@ -40,6 +40,12 @@ usage ()
start () start ()
{ {
# (Re)start mdmon to take over monitoring of mdmon started from the initrd
if [ -f /dev/.mdadm/*.pid ]; then
origprog="$prog"; prog="mdmon"
action $"Starting $prog: " /sbin/mdmon /proc/mdstat /
prog="$origprog"
fi
# Make sure configuration file exists and has information we can use # Make sure configuration file exists and has information we can use
# MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor # MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor
[ -f /etc/mdadm.conf ] || return 6 [ -f /etc/mdadm.conf ] || return 6

View File

@ -1 +1 @@
7a1ba5aaaa04e34ef85b85fcadbf2519 mdadm-3.0-0.20090915git.tar.bz2 38f7e3e073fcf35fc766686bd414488b mdadm-3.0.2.tar.bz2