OBS User unknown 2008-01-24 17:30:41 +00:00 committed by Git OBS Bridge
parent 8d52414b72
commit e085e7776b
5 changed files with 81 additions and 230 deletions

10
boot.md
View File

@ -116,8 +116,8 @@ case "$1" in
/sbin/udevsettle --timeout="$MDADM_DEVICE_TIMEOUT"
fi
if test "$BOOT_MD_USE_MDADM_CONFIG" = "yes" -a -s "$mdadm_CONFIG"; then
if ! grep -q '[^[:blank:]]' $mdadm_CONFIG; then
if test "$BOOT_MD_USE_MDADM_CONFIG" = "yes" -a -e "$mdadm_CONFIG"; then
if ! grep -q '^[^#]*[^[:blank:]#]' $mdadm_CONFIG; then
# empty /etc/mdadm.conf, "unused"
rc_status -u
fi
@ -127,12 +127,14 @@ case "$1" in
fi
else
# do auto-assemly only if /etc/mdadm.conf is missing
rm -f /tmp/mdadm.conf
# run at boot-time, so a fixed tmp name is safe
rm -rf /tmp/mdadm.conf
if ! mdadm --examine --scan --config=partitions >/tmp/mdadm.conf
then
rc_failed 1
rc_status -v
fi
chmod 0600 /tmp/mdadm.conf
if test -s /tmp/mdadm.conf; then
if ! mdadm --assemble --scan --config=/tmp/mdadm.conf
then
@ -140,7 +142,7 @@ case "$1" in
rc_status -v
fi
else
# partitions found, "unused"
# no partitions found, "unused"
rc_status -u
fi

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Jan 23 15:55:24 CET 2008 - mmarek@suse.cz
- fixed auto-assembly part of boot.md
* if /etc/mdadm.conf is empy or only contains whitespace or
comments, no autoassembly is done
* remove /tmp/mdadm.conf even if a directory [#329678]
- dropped mdrun and raidautorun (no longer needed)
-------------------------------------------------------------------
Wed Oct 24 17:08:11 CEST 2007 - mmarek@suse.cz

View File

@ -1,7 +1,7 @@
#
# spec file for package mdadm (Version 2.6.4)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
@ -12,7 +12,7 @@
Name: mdadm
Version: 2.6.4
Release: 1
Release: 17
BuildRequires: sgmltool
PreReq: %fillup_prereq %insserv_prereq
Obsoletes: raidtools
@ -27,8 +27,6 @@ Source1: Software-RAID.HOWTO.tar.bz2
Source2: sysconfig.mdadm
Source3: mdadmd
Source4: boot.md
Source5: mdrun
Source6: raidautorun.c
%description
Mdadm is a program that can be used to control Linux md devices. It is
@ -47,7 +45,6 @@ Authors:
%build
%{suse_update_config -f}
make CXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-error"
gcc $RPM_OPT_FLAGS %{S:6} -o raidautorun
cd Software-RAID.HOWTO
sgml2html Software-RAID.HOWTO.sgml
sgml2txt Software-RAID.HOWTO.sgml
@ -57,7 +54,6 @@ make install DESTDIR=$RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_var}/adm/fillup-templates
install -d $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/init.d}
install -d $RPM_BUILD_ROOT/lib/udev/devices
install -m 755 %{S:5} raidautorun $RPM_BUILD_ROOT/sbin/
install -m 755 %{S:4} %{S:3} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/
install -m 644 %{S:2} $RPM_BUILD_ROOT%{_var}/adm/fillup-templates/
ln -sf ../../etc/init.d/mdadmd $RPM_BUILD_ROOT/%{_sbindir}/rcmdadmd
@ -117,8 +113,15 @@ rm -rf $RPM_BUILD_ROOT
/lib/udev
%{_sbindir}/*
%{_var}/adm/fillup-templates/sysconfig.mdadm
%changelog
* Wed Oct 24 2007 - mmarek@suse.cz
* Wed Jan 23 2008 mmarek@suse.cz
- fixed auto-assembly part of boot.md
* if /etc/mdadm.conf is empy or only contains whitespace or
comments, no autoassembly is done
* remove /tmp/mdadm.conf even if a directory [#329678]
- dropped mdrun and raidautorun (no longer needed)
* Wed Oct 24 2007 mmarek@suse.cz
- updated to 2.6.4
* Make "--create --auto=mdp" work for non-standard device names.
* Fix restarting of a 'reshape' if it was stopped in the middle.
@ -145,12 +148,12 @@ rm -rf $RPM_BUILD_ROOT
metadata, and be more specific in the "metadata=" message
printed with --examine --brief
* Fix spare migration in --monitor.
* Fri Jul 27 2007 - mmarek@suse.cz
* Fri Jul 27 2007 mmarek@suse.cz
- changes to the init script [#288454]
* don't try to autoassemble if /etc/mdadm.conf exists (even an
empty one)
* ony autoassemble partitions found in /proc/partitions
* Fri Jul 13 2007 - mmarek@suse.cz
* Fri Jul 13 2007 mmarek@suse.cz
- updated to 2.6.2
* --fail detached and --remove faulty can be used to fail and
remove devices that are no longer physically present.
@ -165,9 +168,9 @@ rm -rf $RPM_BUILD_ROOT
* Make return code for "--detail --test" more reliable. Missing
devices as well as failed devices cause an error.
- added some fixes from Neil's git repo (mdadm-git-fixes.patch)
* Thu Jun 21 2007 - adrian@suse.de
* Thu Jun 21 2007 adrian@suse.de
- fix changelog entry order
* Mon Apr 02 2007 - mmarek@suse.cz
* Mon Apr 02 2007 mmarek@suse.cz
- updated to 2.6.1
* --monitor was producing some meaningless warnings due to a bug.
* Fix some compiler warnings.
@ -284,95 +287,95 @@ rm -rf $RPM_BUILD_ROOT
intended for use with udev.
* lots of bugfixes
* manpage updates
* Wed Jan 10 2007 - mmarek@suse.cz
* Wed Jan 10 2007 mmarek@suse.cz
- use raidautorun instead of mdrun to autodetect the raid arrays in
boot.md [#230733]
* Wed Nov 08 2006 - prusnak@suse.cz
* Wed Nov 08 2006 prusnak@suse.cz
- fixed subscript out of range [#212697]
* Wed Sep 20 2006 - mjancar@suse.cz
* Wed Sep 20 2006 mjancar@suse.cz
- update to 2.5.3
* lots bugfixes
* drop all patches (integrated upstream)
* Fri Jul 28 2006 - olh@suse.de
* Fri Jul 28 2006 olh@suse.de
- remove dropped boot.ibmsis from boot.md
- boot.rootfsck should start before boot.md (#181972)
* Fri Jul 21 2006 - olh@suse.de
* Fri Jul 21 2006 olh@suse.de
- remove boot.proc from Required-Start: in boot.md (#178753)
* Wed May 03 2006 - mjancar@suse.cz
* Wed May 03 2006 mjancar@suse.cz
- fix false SparesMissing error (#171326)
* Wed Apr 26 2006 - hare@suse.de
* Wed Apr 26 2006 hare@suse.de
- Fix init script dependencies
- Implement MDADM_DEVICE_TIMEOUT to set a timeout for
udevsettle (#149979)
* Tue Apr 25 2006 - mjancar@suse.cz
* Tue Apr 25 2006 mjancar@suse.cz
- add static device nodes for udev (#168824)
* Wed Apr 19 2006 - mjancar@suse.cz
* Wed Apr 19 2006 mjancar@suse.cz
- set $BOOT_MD_USE_MDADM_CONFIG to "yes" by default (#155120)
* Fri Apr 07 2006 - mjancar@suse.cz
* Fri Apr 07 2006 mjancar@suse.cz
- detach mdadmd from tty in rcmdadmd (#160881)
* Mon Apr 03 2006 - mjancar@suse.cz
* Mon Apr 03 2006 mjancar@suse.cz
- fix garbled output with --detail (#160827)
- fix fix write-mostly with --add and --re-add (#162968)
* Fri Mar 24 2006 - mjancar@suse.cz
* Fri Mar 24 2006 mjancar@suse.cz
- add /sbin/raidautorun (#159460)
* Wed Mar 08 2006 - mjancar@suse.cz
* Wed Mar 08 2006 mjancar@suse.cz
- add $BOOT_MD_USE_MDADM_CONFIG sysconfig variable (#155120)
* Thu Feb 09 2006 - mjancar@suse.cz
* Thu Feb 09 2006 mjancar@suse.cz
- round free size to chunk size multiply on --create (#148562)
* Tue Feb 07 2006 - mjancar@suse.cz
* Tue Feb 07 2006 mjancar@suse.cz
- move boot.multipath to Should-Start instead of Required-Start
* Mon Feb 06 2006 - mjancar@suse.cz
* Mon Feb 06 2006 mjancar@suse.cz
- add "Obsoletes: raidtools"
- start boot.md after boot.multipath
- call mdadm without -a from mdrun, an argument is required in 2.2
* Mon Feb 06 2006 - mjancar@suse.de
* Mon Feb 06 2006 mjancar@suse.de
- don't start mdadmd by default
* Sun Feb 05 2006 - mjancar@suse.cz
* Sun Feb 05 2006 mjancar@suse.cz
- include option for email to be sent on start (#142105)
- fix missing md autostart due to raidtools dropped (#148234)
* include mdrun script from Debian
* create boot.md initscipt
* Sun Feb 05 2006 - schwab@suse.de
* Sun Feb 05 2006 schwab@suse.de
- Fix memset parameters.
* Thu Feb 02 2006 - mjancar@suse.cz
* Thu Feb 02 2006 mjancar@suse.cz
- fix segfault on --assemble (#146514)
* Fri Jan 27 2006 - mls@suse.de
* Fri Jan 27 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Jan 25 2006 - olh@suse.de
* Wed Jan 25 2006 olh@suse.de
- fix uninitialized variable, memset call and memcmp/memcpy bug
mdadm.bug144647-array.init.patch
mdadm.bug144647-update_super1-memcpy.patch
mdadm.bug144647-add_internal_bitmap0-memcpy.patch
* Wed Jan 11 2006 - mjancar@suse.cz
* Wed Jan 11 2006 mjancar@suse.cz
- update ro 2.2
* Tue Dec 20 2005 - ro@suse.de
* Tue Dec 20 2005 ro@suse.de
- at least output errors if they occur (instead of ignoring)
* Wed Nov 30 2005 - schwab@suse.de
* Wed Nov 30 2005 schwab@suse.de
- Fix broken formats.
* Tue Oct 25 2005 - aj@suse.de
* Tue Oct 25 2005 aj@suse.de
- Build with -fno-strict-aliasing.
* Wed Oct 12 2005 - mjancar@suse.cz
* Wed Oct 12 2005 mjancar@suse.cz
- update to 2.1
* Thu Jul 28 2005 - anicka@suse.cz
* Thu Jul 28 2005 anicka@suse.cz
- update to 1.12.0
* Wed Jun 15 2005 - meissner@suse.de
* Wed Jun 15 2005 meissner@suse.de
- use RPM_OPT_FLAGS correctly.
* Tue Apr 19 2005 - postadal@suse.de
* Tue Apr 19 2005 postadal@suse.de
- updated to version 1.11.0
- fixed for gcc 4.0
- removed obsoleted patch config-fix
* Wed Mar 30 2005 - postadal@suse.cz
* Wed Mar 30 2005 postadal@suse.cz
- fixed parsing command line option '--config=partions' [#74603]
* Fri Feb 04 2005 - postadal@suse.cz
* Fri Feb 04 2005 postadal@suse.cz
- updated to version 1.9.0
* Thu Jan 13 2005 - postadal@suse.cz
* Thu Jan 13 2005 postadal@suse.cz
- updated to version 1.8.1
- extended comment in sysconfig.mdadm [#48567]
* Fri Aug 06 2004 - postadal@suse.cz
* Fri Aug 06 2004 postadal@suse.cz
- updated to version 1.6.0
* added --auto= and --assume-clean options
* added "degraded" and "recovering" options to the "Status:" entry
* Tue Feb 10 2004 - postadal@suse.cz
* Tue Feb 10 2004 postadal@suse.cz
- updated to version 1.5.0
* new commands "mdassemble"
* support for raid6 as found in 2.6.2
@ -380,39 +383,39 @@ rm -rf $RPM_BUILD_ROOT
naming scheme
* added "SparesMissing" event when --monitor first sees an array and
it doesn't have the enough spare devices.
* Sun Jan 11 2004 - adrian@suse.de
* Sun Jan 11 2004 adrian@suse.de
- add %%defattr
* Mon Dec 01 2003 - fehr@suse.de
* Mon Dec 01 2003 fehr@suse.de
- fix quoting problem in start script (#33392)
* Fri Aug 29 2003 - fehr@suse.de
* Fri Aug 29 2003 fehr@suse.de
- add PreReq for fillup
* Tue Aug 26 2003 - fehr@suse.de
* Tue Aug 26 2003 fehr@suse.de
- add %%stop_on_removal and %%restart_on_update
* Thu Aug 14 2003 - fehr@suse.de
* Thu Aug 14 2003 fehr@suse.de
- add missing activation metadata in sysconfig (#28901)
* Tue Jul 29 2003 - fehr@suse.de
* Tue Jul 29 2003 fehr@suse.de
- update to new version 1.3.0 of package
* Mon Apr 14 2003 - postadal@suse.cz
* Mon Apr 14 2003 postadal@suse.cz
- fixed init script (added return value for unimplemented reload function)
* Mon Mar 31 2003 - postadal@suse.cz
* Mon Mar 31 2003 postadal@suse.cz
- added buildroot, init script, sysconfig
- bzip2 sources and cleaned specfile
* Thu Mar 20 2003 - fehr@suse.de
* Thu Mar 20 2003 fehr@suse.de
- update to version 1.2.0 of package
* Mon Mar 03 2003 - fehr@suse.de
* Mon Mar 03 2003 fehr@suse.de
- update to version 1.1.0 of package
* Mon Dec 02 2002 - fehr@suse.de
* Mon Dec 02 2002 fehr@suse.de
- Fix for new glibc/gcc
* Tue Sep 17 2002 - ro@suse.de
* Tue Sep 17 2002 ro@suse.de
- removed bogus self-provides
* Fri Sep 13 2002 - lmb@suse.de
* Fri Sep 13 2002 lmb@suse.de
- Fix for 64bit arch; ioctl returns long instead of int (#20339)
* Fri Aug 23 2002 - lmb@suse.de
* Fri Aug 23 2002 lmb@suse.de
- Multipath arrays can now be build manually even without a superblock.
- One debugging chunk removed from patch.
* Tue Aug 13 2002 - lmb@suse.de
* Tue Aug 13 2002 lmb@suse.de
- Fix for the assembly of multipath arrays.
* Mon Aug 12 2002 - lmb@suse.de
* Mon Aug 12 2002 lmb@suse.de
- Added patch to support the enhanced multipath features.
* Mon Aug 05 2002 - fehr@suse.de
* Mon Aug 05 2002 fehr@suse.de
- make SuSE package from version 1.0.1 of mdadm

147
mdrun
View File

@ -1,147 +0,0 @@
#!/bin/sh
# mdrun, (c) Eduard Bloch <blade@debian.org> 2003
# Usage:
# Without arguments: autodetect all RAID partitions and activate MDs
# Arguments: [ DEVDIR ] NUMBER UUID [ <NUMBER UUID> ... ]
# a number of number/uuid pairs, where NUMBER is the one from /dev/md/*
# Argument: LIST
# lists all raids in the syntax needed for the pairs (see above)
# IMPORTANT: create /dev/fs directory if you have devfs support in the kernel
# but do not want to mount it over /dev. Usage of /dev/fs directory will keep
# mdrun away from /dev.
# If the first argument is a directory, it will be used as a writeable
# temporary directory for device nodes. mdrun needs mknod to create them
# on-the-fly
# Environment:
# MORERAIDVOLUMES (list of strings) : additional raid disks to scan,
# eg. loop devices
if ! test -e /proc/partitions ; then
echo "/proc not mounted!"
exit 1
fi
DEVDIR=/dev
if [ -d "$1" ] ; then
AUTOCREATE=true
DEVDIR="$1"
shift
fi
# For people that compile the kernel with devfs (means: different
# proc/partitions content), but without auto-mounting it
if ! uname -r | grep "^2.6" 1>/dev/null && [ -z "$AUTOCREATE" ] && grep " devfs" /proc/filesystems >/dev/null 2>&1 && ! grep "^devfs" /proc/mounts >/dev/null 2>&1 ; then
mkdir /dev/fs 2>/dev/null
# if we can do it - good, we will use it. Otherwise, use /dev even if it is ugly
# mount devfs for now to make the device names match, umount later
if [ -d /dev/fs ] ; then
DEVDIR=/dev/fs
fi
mount none $DEVDIR -tdevfs
UMNTDEVFS="umount $DEVDIR"
fi
# arr(array, index): return contents in array[index]; as with Bourne shell
# in general, there is no easy way to distinguish between index not
# existing and empty string assigned.
arr() { sa_i=`arr_index $2`; eval "echo \"\$$1_${sa_i}\""; unset sa_i; }
# seterr(array, index, value): assign the given value to array[index].
setarr() { sa_i=`arr_index $2`; eval "$1_${sa_i}=\"$3\""; unset sa_i; }
# arr_index(index): make sure the given index is valid for use.
arr_index() { echo $1 | sed -e 's/:/_/g' | sed 's;/;_;g'; }
BASE=$DEVDIR/md
export BASE
#devfs
test -d $BASE && BASE=$BASE/
next_free_md() {
for raidnr in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24; do
if ! mdadm -D $BASE$raidnr >/dev/null 2>&1 ; then
echo $BASE$raidnr
return 0
fi
done
return 1
}
listpairs() {
for NUMBER in `cat /proc/mdstat | grep "^md. : active" | sed -e 's/^md\(.\) :.*/\1/'`; do
echo $NUMBER
mdadm -D ${BASE}$NUMBER 2>/dev/null |grep UUID | sed 's/.*: \(.*\)/\1/'
done
}
if [ "$1" = LIST ] ; then
echo `listpairs`
$UMNTDEVFS
exit 0
fi
DEVDIRESC=$(echo $DEVDIR | sed -e 's!/!\\/!g')
if [ "$AUTOCREATE" ] ; then
CREATECMD=$(sed -e "s/.*major.*//; s/.*\ \([:0-9:]\+\)\ \+\ \([:0-9:]\+\)\ \+\ [:0-9:]\+\ \+\([:a-z0-9\/:]\+\).*/mknod \3 b \1 \2 ; / ; s/\//_/g" < /proc/partitions)
export CREATECMD
export DEVDIR
# and we need array nodes, of course
(
cd $DEVDIR ;
eval $CREATECMD ;
for x in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ; do
mknod ${BASE}$x b 9 $x
done
)
PARTLIST=$(sed -e "s/.*major.*//; s/.*\ \([:0-9:]\+\)\ \+\ \([:0-9:]\+\)\ \+\ [:0-9:]\+\ \+\([:a-z0-9\/:]\+\).*/DEVDIR\3 /; s/\//_/g ; s/DEVDIR/$DEVDIRESC\//;" < /proc/partitions)
else
PARTLIST=$(sed -e "s/.*major.*//; s/^[:0-9 :]* \([:a-z:].[:a-z0-9\/:]*\).*/\1/; s/^\([:a-z:].*\)/$DEVDIRESC\/\1/g" < /proc/partitions)
fi
for SRC in $PARTLIST $MORERAIDVOLUMES ; do
SUM=$(mdadm -E $SRC 2>/dev/null | grep UUID | sed 's/.*: \(.*\)/\1/')
for x in $SUM; do
UUIDS="$UUIDS $SUM"
setarr MDS $SUM "`arr MDS $SUM` $SRC"
done
done
if [ "$#" -gt 1 ] ; then
NUMBER=${BASE}$1
MD=$2
shift ; shift
if [ "`arr MDS $MD`" != "started" ] ; then
mdadm -A $NUMBER -f `arr MDS $MD` && setarr MDS $MD "started"
# just to be sure
ln /dev/md/$NUMBER /dev/md$NUMBER 2>/dev/null
fi
fi
# and process the rest, if it exists
# do not touch active arrays
#dropactive() {
for NUMBER in `cat /proc/mdstat | grep "^md. : active" | sed -e 's/^md\(.\) :.*/\1/'`; do
setarr MDS `mdadm -D ${BASE}$NUMBER 2>/dev/null |grep UUID | sed 's/.*: \(.*\)/\1/'` "started"
done
#}
for MD in $UUIDS; do
if [ "`arr MDS $MD`" != "started" ] ; then
NUMBER=`next_free_md`
mdadm -A $NUMBER -f `arr MDS $MD` && setarr MDS $MD "started"
# just to be sure
ln /dev/md/$NUMBER /dev/md$NUMBER 2>/dev/null
fi
done
$UMNTDEVFS

View File

@ -1,16 +0,0 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/major.h>
#include <linux/raid/md_u.h>
int main(int argc, char *argv[])
{
int fd = open("/dev/md0", O_RDWR);
if (fd >= 0) {
ioctl(fd, RAID_AUTORUN, 0);
close(fd);
}
return (0);
}