Accepting request 116799 from Base:System

New upstream mdadm for openSUSE 12.2

- New upstream version: 3.2.4. /run/mdadm is not
  used for runtime files, not /var/run or /dev/.mdadm.

OBS-URL: https://build.opensuse.org/request/show/116799
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=67
This commit is contained in:
Stephan Kulow
2012-05-09 16:18:17 +00:00
committed by Git OBS Bridge
8 changed files with 19 additions and 1161 deletions

View File

@@ -1,125 +0,0 @@
From b451aa4846c5ccca5447a6b6d45e5623b8c8e961 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Thu, 6 Oct 2011 13:00:28 +1100
Subject: [PATCH] Fix handling for "auto" line in mdadm.conf
Two problems.
1/ pol_merge was ignoring the pol_auto tag so any 'auto' information
was lost
2/ If a device had not path (e.g. loop devices) or if there were no
path-based policies, we didn't bother looking for policy at all.
So path-independant policies were ignored.
Reported-by: Christian Boltz <suse-beta@cboltz.de>
Signed-off-by: NeilBrown <neilb@suse.de>
---
policy.c | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/policy.c b/policy.c
index 4a6ef82..ef48353 100644
--- a/policy.c
+++ b/policy.c
@@ -195,7 +195,9 @@ static char *disk_path(struct mdinfo *disk)
int prefix_len;
DIR *by_path;
char symlink[PATH_MAX] = "/dev/disk/by-path/";
+ char nm[PATH_MAX];
struct dirent *ent;
+ int rv;
by_path = opendir(symlink);
if (!by_path)
@@ -218,7 +220,17 @@ static char *disk_path(struct mdinfo *disk)
return strdup(ent->d_name);
}
closedir(by_path);
- return NULL;
+ /* A NULL path isn't really acceptable - use the devname.. */
+ sprintf(symlink, "/sys/dev/block/%d:%d", disk->disk.major, disk->disk.minor);
+ rv = readlink(symlink, nm, sizeof(nm));
+ if (rv > 0) {
+ char *dname;
+ nm[rv] = 0;
+ dname = strrchr(nm, '/');
+ if (dname)
+ return strdup(dname + 1);
+ }
+ return strdup("unknown");
}
char type_part[] = "part";
@@ -245,13 +257,13 @@ static int pol_match(struct rule *rule, char *path, char *type)
if (rule->name == rule_path) {
if (pathok == 0)
pathok = -1;
- if (fnmatch(rule->value, path, 0) == 0)
+ if (path && fnmatch(rule->value, path, 0) == 0)
pathok = 1;
}
if (rule->name == rule_type) {
if (typeok == 0)
typeok = -1;
- if (strcmp(rule->value, type) == 0)
+ if (type && strcmp(rule->value, type) == 0)
typeok = 1;
}
rule = rule->next;
@@ -270,7 +282,8 @@ static void pol_merge(struct dev_policy **pol, struct rule *rule)
for (r = rule; r ; r = r->next)
if (r->name == pol_act ||
- r->name == pol_domain)
+ r->name == pol_domain ||
+ r->name == pol_auto)
pol_new(pol, r->name, r->value, metadata);
}
@@ -280,7 +293,10 @@ static int path_has_part(char *path, char **part)
* if it does, place a pointer to "-pathNN"
* in 'part'.
*/
- int l = strlen(path);
+ int l;
+ if (!path)
+ return 0;
+ l = strlen(path);
while (l > 1 && isdigit(path[l-1]))
l--;
if (l < 5 || strncmp(path+l-5, "-part", 5) != 0)
@@ -343,9 +359,6 @@ struct dev_policy *path_policy(char *path, char *type)
struct dev_policy *pol = NULL;
int i;
- if (!type)
- return NULL;
-
rules = config_rules;
while (rules) {
@@ -366,7 +379,7 @@ struct dev_policy *path_policy(char *path, char *type)
/* Now add any metadata-specific internal knowledge
* about this path
*/
- for (i=0; superlist[i]; i++)
+ for (i=0; path && superlist[i]; i++)
if (superlist[i]->get_disk_controller_domain) {
const char *d =
superlist[i]->get_disk_controller_domain(path);
@@ -399,12 +412,8 @@ struct dev_policy *disk_policy(struct mdinfo *disk)
char *type = disk_type(disk);
struct dev_policy *pol = NULL;
- if (!type)
- return NULL;
if (config_rules_has_path)
path = disk_path(disk);
- if (!path)
- return NULL;
pol = path_policy(path, type);
--
1.7.6.4

View File

@@ -98,12 +98,7 @@ case "$1" in
start)
echo -n "Starting MD RAID "
# create the /var/run/mdadm symlink if needed
mkdir -p /dev/.mdadm
if test ! /dev/.mdadm -ef /var/run/mdadm; then
rm -rf /var/run/mdadm
ln -s /dev/.mdadm /var/run/mdadm
fi
mkdir -p /run/mdadm
# restart mdmon (exits silently if there is nothing to monitor)
/sbin/mdmon --all --takeover
# Check for existence of needed config file and read it

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0d1a04e688b082bc88846e3f524abd50bc782b6ffc06123140f7d358c8f9b906
size 357234

File diff suppressed because it is too large Load Diff

3
mdadm-3.2.4.tar.bz2 Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3dc439732aa5c0a716bccf57ea673b6e4844ac8eb49a90f2bd5878772c4eaa34
size 368798

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed May 9 01:22:11 UTC 2012 - nfbrown@suse.com
- New upstream version: 3.2.4. /run/mdadm is not
used for runtime files, not /var/run or /dev/.mdadm.
-------------------------------------------------------------------
Fri Apr 20 08:00:33 UTC 2012 - rmilasan@suse.com

View File

@@ -17,7 +17,7 @@
Name: mdadm
Version: 3.2.2
Version: 3.2.4
Release: 0
BuildRequires: sgmltool
PreReq: %fillup_prereq %insserv_prereq /sbin/mkinitrd
@@ -34,8 +34,6 @@ Source3: mdadmd
Source4: boot.md
Source5: mkinitrd-setup.sh
Source6: mkinitrd-boot.sh
Patch0: mdadm-3.2.2_git3b1dab1bdbda0
Patch1: auto-line.fix
%description
Mdadm is a program that can be used to control Linux md devices. It is
@@ -44,8 +42,6 @@ programs but with a very different interface.
%prep
%setup -q -a1
%patch0 -p1
%patch1 -p1
%build
make %{?_smp_mflags} CC="%__cc" CXFLAGS="$RPM_OPT_FLAGS -Wno-error"
@@ -64,9 +60,8 @@ install -m 755 %{S:5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-md.sh
install -m 755 %{S:6} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-md.sh
install -m 644 %{S:2} $RPM_BUILD_ROOT%{_var}/adm/fillup-templates/
ln -sf ../../etc/init.d/mdadmd $RPM_BUILD_ROOT/%{_sbindir}/rcmdadmd
rm -rf $RPM_BUILD_ROOT/var/run/mdadm
mkdir -p $RPM_BUILD_ROOT/var/run
ln -s mdadm $RPM_BUILD_ROOT/var/run/mdadm
rm -rf $RPM_BUILD_ROOT/run/mdadm
mkdir -p $RPM_BUILD_ROOT/run/mdadm
install -d $RPM_BUILD_ROOT/lib/udev/rules.d
install -m 644 udev-md-raid.rules $RPM_BUILD_ROOT/lib/udev/rules.d/64-md-raid.rules
@@ -80,16 +75,9 @@ elif [ -x /sbin/mkinitrd ]; then
fi
%{fillup_and_insserv -y boot.md}
mkdir -p /dev/.mdadm
# replace the /var/run/mdadm directory (installed by sle11/11.1) with
# a symlink pointing to /dev/.mdadm. Do not do this when /var/run/mdadm is
# not empty, let /etc/init.d/boot.md do it at the next reboot.
if test -e /var/run/mdadm -a ! /var/run/mdadm -ef /dev/.mdadm; then
if ! rmdir /var/run/mdadm 2>/dev/null; then
exit 0
fi
ln -s /dev/.mdadm /var/run/mdadm
fi
# If /run/mdadm is already a symlink, this will fail and will have
# to wait for next boot.
mkdir -p /run/mdadm || true
%postun
%restart_on_update mdadmd
@@ -120,7 +108,7 @@ rm -rf $RPM_BUILD_ROOT
%dir /lib/udev/devices
%{_sbindir}/*
%{_var}/adm/fillup-templates/sysconfig.mdadm
%ghost /var/run/mdadm
%ghost /run/mdadm
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
/lib/mkinitrd/scripts/setup-md.sh

View File

@@ -18,11 +18,8 @@
# load the necessary module before we initialize the raid system
load_modules
# put the mdmon socked and pid file to /dev/.mdadm
rm -rf /var/run/mdadm
mkdir -p /var/run
ln -s /dev/.mdadm /var/run/mdadm
mkdir -p /dev/.mdadm
# Create dir for socket and pid files
mkdir -p /run/mdadm
[ "$mduuid" ] && md_uuid="$mduuid"
md_major=$(sed -ne 's/\s*\([0-9]\+\)\s*md$/\1/p' /proc/devices)