- make /dev/md if necessary in incremental mode (#429604)

- open RAID devices with O_EXCL to avoid racing against other --incremental
    processes (#433932)
This commit is contained in:
Bill Nottingham 2008-04-17 16:27:33 +00:00
parent c2e4c0a048
commit 8fe36f4e44
2 changed files with 43 additions and 2 deletions

View File

@ -0,0 +1,35 @@
diff -ru mdadm-2.6.4/mdopen.c mdadm-2.6.4-fixed/mdopen.c
--- mdadm-2.6.4/mdopen.c 2007-10-16 05:47:25.000000000 -0400
+++ mdadm-2.6.4-fixed/mdopen.c 2008-04-16 19:04:08.000000000 -0400
@@ -302,6 +302,7 @@
*/
int major_num, minor_num;
struct stat stb;
+ int i;
if (devname)
strcpy(chosen_name, devname);
@@ -333,11 +334,22 @@
return -1;
}
} else {
+ if (strncmp(chosen_name, "/dev/md/", 8) == 0) {
+ mkdir("/dev/md", 0755);
+ }
if (mknod(chosen_name, S_IFBLK | 0600,
makedev(major_num, minor_num)) != 0) {
return -1;
}
/* FIXME chown/chmod ?? */
}
- return open(chosen_name, O_RDWR);
+ for (i = 0; i < 25 ; i++) {
+ int fd;
+
+ fd = open(chosen_name, O_RDWR|O_EXCL);
+ if (fd >= 0)
+ return fd;
+ usleep(200000);
+ }
+ return -1;
}

View File

@ -1,7 +1,7 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm
Version: 2.6.4
Release: 3%{?dist}
Release: 4%{?dist}
Source: http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz
Source1: mdmonitor.init
Source2: mdadm.rules
@ -10,6 +10,7 @@ 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
Group: System Environment/Base
@ -33,6 +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
%build
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" SYSCONFDIR="%{_sysconfdir}" MDASSEMBLE_AUTO=1 mdassemble.static mdassemble mdadm.static mdadm
@ -83,7 +85,11 @@ fi
%attr(0700,root,root) %dir /var/run/mdadm
%changelog
* Fri Feb 1 2008 Bill Nottingham <notting@redht.com> - 2.6.4-3
* Thu Apr 17 2008 Bill Nottingham <notting@redhat.com> - 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)
* Fri Feb 1 2008 Bill Nottingham <notting@redhat.com> - 2.6.4-3
- add a udev rules file for device assembly (#429604)
* Fri Jan 18 2008 Doug Ledford <dledford@redhat.com> - 2.6.4-2