Accepting request 29138 from Base:System
Copy from Base:System/mdadm based on submit request 29138 from user michal-m OBS-URL: https://build.opensuse.org/request/show/29138 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=36
This commit is contained in:
commit
568a395350
@ -1,32 +0,0 @@
|
|||||||
From 0e90271e53c0f6efb33e904cf407498350e2a14d Mon Sep 17 00:00:00 2001
|
|
||||||
From: NeilBrown <neilb@suse.de>
|
|
||||||
Date: Thu, 1 Oct 2009 12:38:31 +1000
|
|
||||||
Subject: [PATCH 1/2] Add missing space in "--detail --brief" output.
|
|
||||||
|
|
||||||
We need a space between the device name and the word "level"..
|
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.de>
|
|
||||||
---
|
|
||||||
Detail.c | 4 ++--
|
|
||||||
1 files changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Detail.c b/Detail.c
|
|
||||||
index 001012a..a70db34 100644
|
|
||||||
--- a/Detail.c
|
|
||||||
+++ b/Detail.c
|
|
||||||
@@ -207,11 +207,11 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
|
|
||||||
printf("ARRAY %s", dev);
|
|
||||||
if (brief > 1) {
|
|
||||||
if (array.raid_disks)
|
|
||||||
- printf("level=%s num-devices=%d",
|
|
||||||
+ printf(" level=%s num-devices=%d",
|
|
||||||
c?c:"-unknown-",
|
|
||||||
array.raid_disks );
|
|
||||||
else
|
|
||||||
- printf("level=container num-devices=%d",
|
|
||||||
+ printf(" level=container num-devices=%d",
|
|
||||||
array.nr_disks);
|
|
||||||
}
|
|
||||||
if (container) {
|
|
||||||
--
|
|
||||||
1.6.3.3
|
|
@ -1,48 +0,0 @@
|
|||||||
From 2b9aa337af7291d3f141322da96c9f667c99d53c Mon Sep 17 00:00:00 2001
|
|
||||||
From: NeilBrown <neilb@suse.de>
|
|
||||||
Date: Thu, 1 Oct 2009 12:51:04 +1000
|
|
||||||
Subject: [PATCH 2/2] 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>
|
|
||||||
---
|
|
||||||
mapfile.c | 15 +++++++++------
|
|
||||||
1 files changed, 9 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
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';
|
|
||||||
--
|
|
||||||
1.6.3.3
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:821c2a073daed4916973226a6c623de5d697cceb077de935e2b1c316b11f3da7
|
|
||||||
size 252754
|
|
3
mdadm-3.0.3.tar.bz2
Normal file
3
mdadm-3.0.3.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:b51a52aebfb83b09ae7faee9eebb4d49a7ad27767bcc9569079df62c7d510599
|
||||||
|
size 257554
|
@ -1,8 +1,27 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jan 6 15:47:03 CET 2010 - mmarek@suse.cz
|
||||||
|
|
||||||
|
- mkinitrd-*.sh: fix booting from partitionable md devices and
|
||||||
|
from container devices (bnc#565219).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Dec 15 20:26:46 CET 2009 - jengelh@medozas.de
|
Tue Dec 15 20:26:46 CET 2009 - jengelh@medozas.de
|
||||||
|
|
||||||
- enable parallel building
|
- enable parallel building
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Dec 4 18:00:40 CET 2009 - mmarek@suse.cz
|
||||||
|
|
||||||
|
- Support for partitionable md devices in mkinitrd scripts
|
||||||
|
(fate#305883).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Nov 3 11:03:54 CET 2009 - mmarek@suse.cz
|
||||||
|
|
||||||
|
- update to 3.0.3 (fate#307159)
|
||||||
|
* mdmon improvements (needed for fate#306823)
|
||||||
|
* other fixes
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Oct 30 16:49:40 CET 2009 - mmarek@suse.cz
|
Fri Oct 30 16:49:40 CET 2009 - mmarek@suse.cz
|
||||||
|
|
||||||
|
12
mdadm.spec
12
mdadm.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package mdadm (Version 3.0.2)
|
# spec file for package mdadm (Version 3.0.3)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
|
|
||||||
Name: mdadm
|
Name: mdadm
|
||||||
Version: 3.0.2
|
Version: 3.0.3
|
||||||
Release: 3
|
Release: 1
|
||||||
BuildRequires: sgmltool
|
BuildRequires: sgmltool
|
||||||
PreReq: %fillup_prereq %insserv_prereq
|
PreReq: %fillup_prereq %insserv_prereq
|
||||||
Obsoletes: raidtools
|
Obsoletes: raidtools
|
||||||
@ -31,8 +31,6 @@ Url: http://www.kernel.org/pub/linux/utils/raid/mdadm/
|
|||||||
Summary: Utility for Configuring MD Setup
|
Summary: Utility for Configuring MD Setup
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
Source: %{name}-%{version}.tar.bz2
|
Source: %{name}-%{version}.tar.bz2
|
||||||
Patch1: 0001-Add-missing-space-in-detail-brief-output.patch
|
|
||||||
Patch2: 0002-Fix-null-dereference-in-set_member_info.patch
|
|
||||||
Source1: Software-RAID.HOWTO.tar.bz2
|
Source1: Software-RAID.HOWTO.tar.bz2
|
||||||
Source2: sysconfig.mdadm
|
Source2: sysconfig.mdadm
|
||||||
Source3: mdadmd
|
Source3: mdadmd
|
||||||
@ -53,8 +51,6 @@ Authors:
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -a1
|
%setup -q -a1
|
||||||
%patch1 -p1
|
|
||||||
%patch2 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{suse_update_config -f}
|
%{suse_update_config -f}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#%stage: softraid
|
#%stage: softraid
|
||||||
#%programs: /sbin/mdadm /sbin/mdmon
|
#%programs: /sbin/mdadm /sbin/mdmon
|
||||||
#%modules: raid0 raid1 raid456
|
#%modules: raid0 raid1 raid10 raid456
|
||||||
#%if: -n "$need_mdadm"
|
#%if: -n "$need_mdadm"
|
||||||
#
|
#
|
||||||
##### MD (Software-)Raid
|
##### MD (Software-)Raid
|
||||||
@ -33,36 +33,41 @@ if [ -f /sys/module/md_mod/parameters/start_ro ]; then
|
|||||||
echo 1 > /sys/module/md_mod/parameters/start_ro
|
echo 1 > /sys/module/md_mod/parameters/start_ro
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$need_mdadm" ]; then
|
md_assemble()
|
||||||
|
{
|
||||||
if [ -f /etc/mdadm.conf ] ; then
|
local dev=$1 mdconf container
|
||||||
mdconf="-Ac /etc/mdadm.conf"
|
|
||||||
[ -z "$md_dev" ] && md_dev="--scan"
|
case "$dev" in
|
||||||
|
/dev/md[0-9]*p[0-9]*)
|
||||||
|
dev=${dev%p[0-9]*}
|
||||||
|
esac
|
||||||
|
if test -f /etc/mdadm.conf; then
|
||||||
|
mdconf="-c /etc/mdadm.conf"
|
||||||
|
container=$( \
|
||||||
|
sed -rn "s:^ARRAY +$dev .*container=([^ ]*).*:\\1:p" \
|
||||||
|
/etc/mdadm.conf)
|
||||||
|
else
|
||||||
|
mdconf="-c partitions"
|
||||||
fi
|
fi
|
||||||
|
if test -n "$container"; then
|
||||||
|
mdadm -A $mdconf --uuid="$container" /dev/md/container
|
||||||
|
fi
|
||||||
|
mdadm -A $mdconf $mdarg "$dev"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -n "$need_mdadm" ]; then
|
||||||
|
|
||||||
if [ -n "$md_uuid" ] ; then
|
if [ -n "$md_uuid" ] ; then
|
||||||
mdarg="--uuid=$md_uuid"
|
mdarg="--uuid=$md_uuid"
|
||||||
elif [ -n "$md_uuid" ] ; then
|
|
||||||
mdarg="$mdarg --uuid=$md_uuid"
|
|
||||||
fi
|
|
||||||
if [ -n "$md_minor" ] ; then
|
|
||||||
mdarg="$mdarg --super-minor=$md_minor"
|
|
||||||
md_dev="/dev/md$md_minor"
|
|
||||||
elif [ -z "$md_minor" -a -n "$md_minor" ] ; then
|
|
||||||
mdarg="$mdarg --super-minor=$md_minor"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $resumedev in
|
case $resumedev in
|
||||||
/dev/md*)
|
/dev/md*)
|
||||||
echo 1 > /sys/module/md_mod/parameters/start_ro
|
md_assemble "$resumedev"
|
||||||
resume_minor="${resumedev#/dev/md}"
|
|
||||||
mdadm -Ac partitions -m $resume_minor --auto=md $resumedev
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$md_dev" ] ; then
|
if [ -n "$md_dev" ] ; then
|
||||||
/sbin/mdadm $mdconf --auto=md $md_dev || /sbin/mdadm -Ac partitions $mdarg --auto=md $md_dev
|
md_assemble "$md_dev"
|
||||||
fi
|
fi
|
||||||
wait_for_events
|
wait_for_events
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -4,40 +4,95 @@
|
|||||||
#
|
#
|
||||||
mdblockdev=
|
mdblockdev=
|
||||||
|
|
||||||
|
# Full mdadm.conf generated by mdadm.
|
||||||
|
# Contains all created MD RAIDs
|
||||||
|
mdadm_conf=$(mdadm --examine --brief --scan)
|
||||||
|
|
||||||
|
cont_list=
|
||||||
|
md_devs=
|
||||||
|
|
||||||
|
# blockdev contains real devices (/dev/X) for root, resume, journal, dumb
|
||||||
|
echo "blockdev: $blockdev"
|
||||||
for bd in $blockdev ; do
|
for bd in $blockdev ; do
|
||||||
# get information about the current blockdev
|
is_part_dev=false
|
||||||
update_blockdev $bd
|
case $bd in
|
||||||
mdconf=$(mdadm -Db $bd 2> /dev/null | sed -n "s@/dev/md[0-9]*@/dev/md$blockminor@p")
|
/dev/md[0-9]*p[0-9]*)
|
||||||
if [ -n "$mdconf" ] ; then
|
# Partitionable MD RAID. This is partition on RAID. Get the RAID
|
||||||
md_tmpblockdev=$(mdadm -Dbv $bd 2> /dev/null | sed -n "1D;s/,/ /g;s/^ *devices=\(.*\)/\1/p")
|
bd=${bd%%p[0-9]*}
|
||||||
md_dev=${bd##/dev/}
|
is_part_dev=true
|
||||||
dup_found=0
|
;;
|
||||||
for dup in $md_devs; do
|
/dev/md[0-9]*)
|
||||||
if [ x"$dup" = x"$md_dev" ]; then
|
;;
|
||||||
dup_found=1
|
*)
|
||||||
break
|
mdblockdev="$mdblockdev $bd"
|
||||||
fi
|
continue
|
||||||
done
|
;;
|
||||||
if [ $dup_found -eq 0 ]; then
|
esac
|
||||||
mdblockdev="$mdblockdev $md_tmpblockdev"
|
# Check if this device is already added (possible for partitionable).
|
||||||
eval md_conf_${md_dev}=\"$mdconf\"
|
md_dev=${bd##/dev/}
|
||||||
md_devs="$md_devs $md_dev"
|
dup_found=false
|
||||||
root_md=1
|
for dup in $md_devs; do
|
||||||
else
|
if [ x"$dup" = x"$md_dev" ]; then
|
||||||
echo "setup-md.sh: $md_dev found multiple times" >&2
|
dup_found=true
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
mdblockdev="$mdblockdev $bd"
|
if $dup_found; then
|
||||||
|
if ! $is_part_dev; then
|
||||||
|
echo "setup-md.sh: $md_dev found multiple times" >&2
|
||||||
|
fi
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# Get UUID of block device
|
||||||
|
tmp_uuid=$(mdadm -D $bd --export 2>/dev/null | grep UUID=)
|
||||||
|
if [ -n "$tmp_uuid" ]; then
|
||||||
|
md_tmpblockdev=$(mdadm -Dbv $bd 2> /dev/null | sed -n "1D;s/,/ /g;s/^ *devices=\(.*\)/\1/p")
|
||||||
|
uuid=${tmp_uuid##MD_}
|
||||||
|
# Get the corresponding line from config
|
||||||
|
arr_line=$(echo "$mdadm_conf" | grep "$uuid")
|
||||||
|
if test -z "$arr_line"; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# Check for container
|
||||||
|
cont_line=
|
||||||
|
cont=$(echo "$arr_line" | sed -n "s/.*container=\([0-9a-z]\{8\}:[0-9a-z]\{8\}:[0-9a-z]\{8\}:[0-9a-z]\{8\}\).*/\1/p")
|
||||||
|
if [ -n "$cont" ]; then
|
||||||
|
cnt_dup=0
|
||||||
|
for cnt in $cont_list; do
|
||||||
|
if [ x"$cont"= x"$cnt" ]; then
|
||||||
|
cnt_dup=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ $cnt_dup -eq 0 ]; then
|
||||||
|
cont_list="$cont_list $cont"
|
||||||
|
cont_line=$(echo "$mdadm_conf" | grep "UUID=$cont")
|
||||||
|
cont_line="$cont_line\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# add a line with the "real" md device name so that boot-md.sh finds it
|
||||||
|
cfg_dev=$(echo "$arr_line" | sed -rn 's/^ARRAY +([^ ]*).*/\1/p; T; q')
|
||||||
|
real_dev=$(readlink -f "$cfg_dev")
|
||||||
|
if test -n "$real_dev" -a "$real_dev" != "$cfg_dev"; then
|
||||||
|
arr_line="$arr_line$(echo -e "\\n$arr_line" | \
|
||||||
|
sed -r "s:^(ARRAY +)$cfg_dev:\\1$real_dev:")"
|
||||||
|
fi
|
||||||
|
mdblockdev="$mdblockdev $md_tmpblockdev"
|
||||||
|
# Add ARRAY line (with container line before if needed).
|
||||||
|
cfg_line=$(echo -e "$cont_line$arr_line")
|
||||||
|
eval md_conf_${md_dev}=\""$cfg_line"\"
|
||||||
|
md_devs="$md_devs $md_dev"
|
||||||
|
root_md=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Any 'md' device is replaced by it's component disks.
|
||||||
blockdev="$mdblockdev"
|
blockdev="$mdblockdev"
|
||||||
|
|
||||||
if [ -n "$root_md" ] ; then
|
if [ -n "$root_md" ] ; then
|
||||||
need_mdadm=1
|
need_mdadm=1
|
||||||
echo "DEVICE partitions" > $tmp_mnt/etc/mdadm.conf
|
echo -n "" > $tmp_mnt/etc/mdadm.conf
|
||||||
for md in $md_devs; do
|
for md in $md_devs; do
|
||||||
eval echo \$md_conf_$md >> $tmp_mnt/etc/mdadm.conf
|
eval echo -e \"\$md_conf_$md\" >> $tmp_mnt/etc/mdadm.conf
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user