From a8863c5bdb5d51e61427e795de8a1d057393b6a9 Mon Sep 17 00:00:00 2001 From: Doug Ledford Date: Thu, 26 Jun 2008 23:48:40 +0000 Subject: [PATCH] - Update to latest upstream version (should resolve #444237) - Drop incremental patch as it's now part of upstream - Clean up all the open() calls in the code (#437145) - Fix the build process to actually generate mdassemble (#446988) - Update the udev rules to get additional info about arrays being assembled from the /etc/mdadm.conf file (--scan option) (#447818) - Update the udev rules to run degraded arrays (--run option) (#452459) --- .cvsignore | 1 + mdadm-2.6.1-build.patch | 34 +++++++++++---- mdadm-2.6.4-open.patch | 95 +++++++++++++++++++++++++++++++++++++++++ mdadm.rules | 2 +- mdadm.spec | 23 +++++++--- sources | 1 + 6 files changed, 140 insertions(+), 16 deletions(-) create mode 100644 mdadm-2.6.4-open.patch diff --git a/.cvsignore b/.cvsignore index 82aa8ad..3bdb898 100644 --- a/.cvsignore +++ b/.cvsignore @@ -8,3 +8,4 @@ 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 diff --git a/mdadm-2.6.1-build.patch b/mdadm-2.6.1-build.patch index a6c0a8f..a6ca373 100644 --- a/mdadm-2.6.1-build.patch +++ b/mdadm-2.6.1-build.patch @@ -1,6 +1,6 @@ ---- mdadm-2.6.4/Makefile.build 2007-10-19 12:32:03.000000000 -0400 -+++ mdadm-2.6.4/Makefile 2007-10-19 12:32:17.000000000 -0400 -@@ -102,13 +102,15 @@ mdadm.static : $(OBJS) $(STATICOBJS) +--- 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 @@ -17,14 +17,16 @@ 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 -@@ -121,15 +123,15 @@ test_stripe : restripe.c 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 +-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.static $(ASSEMBLE_SRCS) $(STATICSRC) ++ $(CC) $(ASSEMBLE_FLAGS) $(LDFLAGS) -DHAVE_STDINT_H -o mdassemble $(ASSEMBLE_SRCS) $(STATICSRC) -mdassemble.static : $(ASSEMBLE_SRCS) mdadm.h - rm -f $(OBJS) @@ -32,14 +34,30 @@ + rm -f $(OBJS) $(STATICOBJS) $(CC) $(ASSEMBLE_FLAGS) $(LDFLAGS) -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 $(OBJS) $(STATICOBJS) ++ rm -f $(OJS) $(STATICOBJS) $(UCLIBC_GCC) $(ASSEMBLE_FLAGS) -DUCLIBC -DHAVE_STDINT_H -static -o mdassemble.uclibc $(ASSEMBLE_SRCS) $(STATICSRC) # This doesn't work -@@ -172,10 +174,10 @@ install-klibc : mdadm.klibc install-man +@@ -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 diff --git a/mdadm-2.6.4-open.patch b/mdadm-2.6.4-open.patch new file mode 100644 index 0000000..174d897 --- /dev/null +++ b/mdadm-2.6.4-open.patch @@ -0,0 +1,95 @@ +--- 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<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(); diff --git a/mdadm.rules b/mdadm.rules index bffa738..e70f5b1 100644 --- a/mdadm.rules +++ b/mdadm.rules @@ -3,4 +3,4 @@ # See udev(8) for syntax SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="linux_raid*", \ - RUN+="/sbin/mdadm --incremental $root/%k" + RUN+="/sbin/mdadm --incremental --run --scan $root/%k" diff --git a/mdadm.spec b/mdadm.spec index 2b5f636..fac4ded 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: 2.6.4 -Release: 4%{?dist} -Source: http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz +Version: 2.6.7 +Release: 1%{?dist} +Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.bz2 Source1: mdmonitor.init Source2: mdadm.rules Patch1: mdadm-2.5.2-s390-build.patch @@ -10,9 +10,9 @@ Patch2: mdadm-2.5.2-static.patch Patch3: mdadm-2.2-nodiet.patch Patch4: mdadm-2.5.2-cflags.patch Patch5: mdadm-2.6.1-build.patch -Patch6: mdadm-2.6.4-incremental.patch -URL: http://www.cse.unsw.edu.au/~neilb/source/mdadm/ -License: GPL +Patch6: mdadm-2.6.4-open.patch +URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ +License: GPLv2+ Group: System Environment/Base BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Obsoletes: mdctl,raidtools @@ -34,7 +34,7 @@ file can be used to help with some common tasks. %patch3 -p1 -b .nodiet %patch4 -p1 -b .cflags %patch5 -p1 -b .build -%patch6 -p1 -b .incremental +%patch6 -p1 -b .open %build make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" SYSCONFDIR="%{_sysconfdir}" MDASSEMBLE_AUTO=1 mdassemble.static mdassemble mdadm.static mdadm @@ -85,6 +85,15 @@ fi %attr(0700,root,root) %dir /var/run/mdadm %changelog +* Thu Jun 26 2008 Doug Ledford - 2.6.7-1 +- Update to latest upstream version (should resolve #444237) +- Drop incremental patch as it's now part of upstream +- Clean up all the open() calls in the code (#437145) +- Fix the build process to actually generate mdassemble (#446988) +- Update the udev rules to get additional info about arrays being assembled + from the /etc/mdadm.conf file (--scan option) (#447818) +- Update the udev rules to run degraded arrays (--run option) (#452459) + * Thu Apr 17 2008 Bill Nottingham - 2.6.4-4 - make /dev/md if necessary in incremental mode (#429604) - open RAID devices with O_EXCL to avoid racing against other --incremental processes (#433932) diff --git a/sources b/sources index 33759ae..c033bd3 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ 4235fc330c9d51e6e613a6eee7ebca76 mdadm-2.6.4.tgz +d0aeb5c44281a1d0e8a32a11dca1b481 mdadm-2.6.7.tar.bz2