Accepting request 21463 from Base:System

Copy from Base:System/mdadm based on submit request 21463 from user michal-m

OBS-URL: https://build.opensuse.org/request/show/21463
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=32
This commit is contained in:
OBS User autobuild 2009-10-02 22:44:49 +00:00 committed by Git OBS Bridge
parent f3287147c3
commit f649c846ce
8 changed files with 98 additions and 188 deletions

View File

@ -0,0 +1,32 @@
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

View File

@ -0,0 +1,48 @@
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

View File

@ -1,131 +0,0 @@
From 057fb70bf4e4b284cc06299853122273815b1d6e Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Fri, 7 Nov 2008 22:22:41 +1100
Subject: [PATCH] Start kpartx for imsm devices.
This probably wont get into mainline, but is need on SLES
to create partitions that the YaST partitioner has a chance
of recognising.
Signed-off-by: NeilBrown <neilb@suse.de>
---
Assemble.c | 4 +++-
Create.c | 3 +++
Manage.c | 4 ++++
mdadm.h | 1 +
super-intel.c | 2 +-
util.c | 25 +++++++++++++++++++++++++
6 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index 20c4be7..c597526 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1251,8 +1251,10 @@ int assemble_container_content(struct supertype *st, int mdfd,
fprintf(stderr, " (%d new)", working);
fprintf(stderr, "\n");
}
- wait_for(chosen_name);
close(mdfd);
+ wait_for(chosen_name);
+ if (st->ss->match_metadata_desc("imsm"))
+ run_kpartx('a', chosen_name);
return 0;
/* FIXME should have an O_EXCL and wait for read-auto */
} else {
diff --git a/Create.c b/Create.c
index 783ab09..4368107 100644
--- a/Create.c
+++ b/Create.c
@@ -780,7 +780,10 @@ int Create(struct supertype *st, char *mddev,
ping_monitor(devnum2devname(st->container_dev));
close(container_fd);
}
+ close(mdfd);
wait_for(chosen_name);
+ if (st->ss->match_metadata_desc("imsm"))
+ run_kpartx('a', chosen_name);
} else {
fprintf(stderr, Name ": not starting array - not enough devices.\n");
}
diff --git a/Manage.c b/Manage.c
index 9424650..06f9e05 100644
--- a/Manage.c
+++ b/Manage.c
@@ -219,8 +219,12 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
if (mdi &&
mdi->array.level > 0 &&
is_subarray(mdi->text_version)) {
+ struct map_ent *me = map_by_devnum(&map, devnum);
/* This is mdmon managed. */
close(fd);
+
+ /* Delete any kpartx partitions */
+ run_kpartx('d', me->path);
if (sysfs_set_str(mdi, NULL,
"array_state", "inactive") < 0) {
if (quiet == 0)
diff --git a/mdadm.h b/mdadm.h
index 2b34acf..9d819f9 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -833,6 +833,7 @@ extern char *devnum2devname(int num);
extern int devname2devnum(char *name);
extern int stat2devnum(struct stat *st);
extern int fd2devnum(int fd);
+extern void run_kpartx(char mode, char *dev);
static inline int dev2major(int d)
{
diff --git a/super-intel.c b/super-intel.c
index a2b9bd2..5f06f30 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -636,7 +636,7 @@ static void brief_examine_super_imsm(struct supertype *st)
getinfo_super_imsm(st, &info);
fname_from_uuid(st, &info, nbuf1,'-');
printf("ARRAY /dev/md/%.16s container=%s\n"
- " member=%d auto=mdp UUID=%s\n",
+ " member=%d auto=md UUID=%s\n",
dev->volume, nbuf + 5, i, nbuf1 + 5);
}
}
diff --git a/util.c b/util.c
index 8845a0f..f21d2bb 100644
--- a/util.c
+++ b/util.c
@@ -1327,6 +1327,31 @@ void append_metadata_update(struct supertype *st, void *buf, int len)
}
#endif /* MDASSEMBLE */
+void run_kpartx(char mode, char *dev)
+{
+ char buf[1024];
+ char *cp;
+
+ sprintf(buf, "/sbin/kpartx > /dev/null 2>&1 -%c '", mode);
+
+ cp = buf + strlen(buf);
+ while (cp < buf+sizeof(buf)-10 &&
+ *dev) {
+ if (*dev == '\'') {
+ *cp++ = '\'';
+ *cp++ = '\\';
+ *cp++ = '\'';
+ /* *cp++ = '\''; */
+ }
+ *cp ++ = *dev++;
+ }
+ *cp++ = '\'';
+ *cp++ = 0;
+ system(buf);
+}
+
+
+
#ifdef __TINYC__
/* tinyc doesn't optimize this check in ioctl.h out ... */
unsigned int __invalid_size_argument_for_IOC = 0;
--
1.5.6.5

View File

@ -1,43 +0,0 @@
Manage: rebuild map for 'kpartx -d' at stop
From: Dan Williams <dan.j.williams@intel.com>
mdadm needs the 'map' file to run 'kpartx -d' at array shutdown.
Rebuild it if it does not exist.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
Manage.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/Manage.c b/Manage.c
index 85bb2c8..603e838 100644
--- a/Manage.c
+++ b/Manage.c
@@ -222,11 +222,23 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
mdi->array.level > 0 &&
is_subarray(mdi->text_version)) {
struct map_ent *me = map_by_devnum(&map, devnum);
+
+ if (!me) {
+ RebuildMap();
+ me = map_by_devnum(&map, devnum);
+ }
+
+ if (!me) {
+ fprintf(stderr, Name ": failed to map device %d\n",
+ devnum);
+ return 1;
+ } else
+ run_kpartx('d', me->path);
+
/* This is mdmon managed. */
close(fd);
/* Delete any kpartx partitions */
- run_kpartx('d', me->path);
if (sysfs_set_str(mdi, NULL,
"array_state", "inactive") < 0) {
if (quiet == 0)

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

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

View File

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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Oct 1 10:51:38 CEST 2009 - mmarek@suse.cz
- updated to 3.0.2 + 2 patches
* bugfixes only
-------------------------------------------------------------------
Fri Jun 12 09:43:43 CEST 2009 - mmarek@suse.cz

View File

@ -1,5 +1,5 @@
#
# spec file for package mdadm (Version 3.0)
# spec file for package mdadm (Version 3.0.2)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -19,9 +19,8 @@
Name: mdadm
Version: 3.0
Release: 21
%define ver 3.0
Version: 3.0.2
Release: 1
BuildRequires: sgmltool
PreReq: %fillup_prereq %insserv_prereq
Obsoletes: raidtools
@ -31,10 +30,9 @@ License: GPL v2 or later
Url: http://www.kernel.org/pub/linux/utils/raid/mdadm/
Summary: Utility for Configuring MD Setup
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: %{name}-%{ver}.tar.bz2
# XXX - still needed?
Patch6: Start-kpartx-for-imsm-devices.patch
Patch11: manage-rebuild-map-for-kpartx
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
Source2: sysconfig.mdadm
Source3: mdadmd
@ -54,9 +52,9 @@ Authors:
Neil Brown <neilb@suse.de>
%prep
%setup -q -a1 -n %{name}-%{ver}
#patch6 -p1
#patch11 -p1
%setup -q -a1
%patch1 -p1
%patch2 -p1
%build
%{suse_update_config -f}