diff --git a/.cvsignore b/.cvsignore index 2055b95..84bee54 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,16 +1 @@ -mdmpd-0.4.tgz -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 +mdadm-3.0.2.tar.bz2 diff --git a/mdadm-3.0-calloc.patch b/mdadm-3.0-calloc.patch deleted file mode 100644 index 7ce03fb..0000000 --- a/mdadm-3.0-calloc.patch +++ /dev/null @@ -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; diff --git a/mdadm-3.0-mdmon-dev-.mdadm.patch b/mdadm-3.0-mdmon-dev-.mdadm.patch new file mode 100644 index 0000000..c6c94f1 --- /dev/null +++ b/mdadm-3.0-mdmon-dev-.mdadm.patch @@ -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) diff --git a/mdadm-3.0-rh526761.patch b/mdadm-3.0-rh526761.patch new file mode 100644 index 0000000..b194d0a --- /dev/null +++ b/mdadm-3.0-rh526761.patch @@ -0,0 +1,46 @@ +From: NeilBrown +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 +--- + +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'; diff --git a/mdadm.spec b/mdadm.spec index 11cc7b0..7aa8ea2 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,8 +1,8 @@ Summary: The mdadm program controls Linux md devices (software RAID arrays) Name: mdadm -Version: 3.0 -Release: 4%{?dist} -Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}-0.20090915git.tar.bz2 +Version: 3.0.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 @@ -11,7 +11,8 @@ Patch1: mdadm-2.5.2-static.patch Patch2: mdadm-3.0-endian-FAIL.patch Patch3: mdadm-3.0-metadata.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/ License: GPLv2+ Group: System Environment/Base @@ -36,7 +37,8 @@ file can be used to help with some common tasks. %patch2 -p1 -b .endian %patch3 -p1 -b .metadata %patch4 -p1 -b .uuid -%patch5 -p1 -b .calloc +%patch5 -p1 -b .mdmon +%patch6 -p1 -b .rh526761 %build 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 %changelog +* Fri Oct 2 2009 Hans de Goede - 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 - 3.0-4 - Stop some mdmon segfaults (bz523860) diff --git a/mdmonitor.init b/mdmonitor.init index f2039a0..890bbe6 100755 --- a/mdmonitor.init +++ b/mdmonitor.init @@ -40,6 +40,12 @@ usage () 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 # MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor [ -f /etc/mdadm.conf ] || return 6 diff --git a/sources b/sources index 7928323..2791698 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -7a1ba5aaaa04e34ef85b85fcadbf2519 mdadm-3.0-0.20090915git.tar.bz2 +38f7e3e073fcf35fc766686bd414488b mdadm-3.0.2.tar.bz2