Accepting request 51253 from Base:System

Accepted submit request 51253 from user elvigia

OBS-URL: https://build.opensuse.org/request/show/51253
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=47
This commit is contained in:
Ruediger Oertel 2010-10-22 14:31:48 +00:00 committed by Git OBS Bridge
commit a919852d86
9 changed files with 36 additions and 298 deletions

View File

@ -1,63 +0,0 @@
---
mdadm.h | 1 +
super-intel.c | 4 ++++
util.c | 25 +++++++++++++++++++++++++
3 files changed, 30 insertions(+)
--- mdadm-3.0.3.orig/mdadm.h
+++ mdadm-3.0.3/mdadm.h
@@ -820,6 +820,7 @@ extern int enough(int level, int raid_di
extern int ask(char *mesg);
extern unsigned long long get_component_size(int fd);
extern void remove_partitions(int fd);
+extern int test_partition(int fd);
extern unsigned long long calc_array_size(int level, int raid_disks, int layout,
int chunksize, unsigned long long devsize);
extern int flush_metadata_updates(struct supertype *st);
--- mdadm-3.0.3.orig/super-intel.c
+++ mdadm-3.0.3/super-intel.c
@@ -2582,6 +2582,10 @@ static int load_super_imsm(struct supert
return 0;
#endif
+ if (test_partition(fd))
+ /* IMSM not allowed on partitions */
+ return 1;
+
free_super_imsm(st);
super = alloc_super(0);
--- mdadm-3.0.3.orig/util.c
+++ mdadm-3.0.3/util.c
@@ -168,6 +168,31 @@ void remove_partitions(int fd)
#endif
}
+int test_partition(int fd)
+{
+ /* Check if fd is a whole-disk or a partition.
+ * BLKPG will return EINVAL on a partition, and BLKPG_DEL_PARTITION
+ * will return ENXIO on an invalid partition number.
+ */
+ struct blkpg_ioctl_arg a;
+ struct blkpg_partition p;
+ a.op = BLKPG_DEL_PARTITION;
+ a.data = (void*)&p;
+ a.datalen = sizeof(p);
+ a.flags = 0;
+ memset(a.data, 0, a.datalen);
+ p.pno = 1<<30;
+ if (ioctl(fd, BLKPG, &a) == 0)
+ /* Very unlikely, but not a partition */
+ return 0;
+ if (errno == ENXIO)
+ /* not a partition */
+ return 0;
+
+ return 1;
+}
+
+
int enough(int level, int raid_disks, int layout, int clean,
char *avail, int avail_disks)
{

View File

@ -1,40 +0,0 @@
From: NeilBrown <neilb@suse.de>
Some devices (dasd!) have 4K sectors, so metadata must be
aligned on 4K boundaries.
superblock already is, but bitmap might not be. So force the
bitmap to a 4K boundary for v1.x metadata
It already is for v1.1 and v1.2, so just fix for v1.0
(Note that v0.90 already uses a 4K boundary too).
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/super1.c b/super1.c
index fee22a9..66e9771 100644
--- a/super1.c
+++ b/super1.c
@@ -1437,11 +1437,6 @@ add_internal_bitmap1(struct supertype *st,
*/
offset = 0;
room = choose_bm_space(__le64_to_cpu(sb->size));
- if (room == 4*2) {
- /* make it 3K after the superblock */
- room = 3*2;
- offset = 2;
- }
} else {
room = __le64_to_cpu(sb->super_offset)
- __le64_to_cpu(sb->data_offset)
@@ -1498,8 +1493,9 @@ add_internal_bitmap1(struct supertype *st,
if (offset == 0) {
bits = (size*512) / chunk + 1;
- room = ((bits+7)/8 + sizeof(bitmap_super_t) +511)/512;
- offset = -room;
+ /* Align bitmap space to a 4K boundary as some devices need that */
+ room = ((bits+7)/8 + sizeof(bitmap_super_t) +4095)/4096;
+ offset = -room * 8; /* *8 to convert 4K blocks to sectors */
}
sb->bitmap_offset = __cpu_to_le32(offset);

View File

@ -1,32 +0,0 @@
From 4c1c3ad8cf69763a4c8c4ba692a8cb93327a4abf Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Wed, 24 Feb 2010 11:43:59 +1100
Subject: [PATCH] Assemble: check inargv before complaining about stray arguments.
References: bnc#598827
If --assemble is given a container and some other devices to assemble
an array from, it complains with an error because that doesn't make
sense.
However it currently also complains if the list of devices was extract
from the config file rather than being given on the command line.
That is not appropriate.
So add an '&& inargv' test to ensure that we are really complaining
about the right thing.
Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Dan Williams <dan.j.williams@intel.com>
diff --git a/Assemble.c b/Assemble.c
index e4d6181..23cc438 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -434,7 +434,7 @@ int Assemble(struct supertype *st, char *mddev,
}
}
st = tst; tst = NULL;
- if (!auto_assem && tmpdev->next != NULL) {
+ if (!auto_assem && inargv && tmpdev->next != NULL) {
fprintf(stderr, Name ": %s is a container, but is not "
"only device given: confused and aborting\n",
devname);

View File

@ -1,142 +0,0 @@
From: Dan Williams <dan.j.williams@intel.com>
References: bnc#587925
Subject: Create: cleanup after failed create in duplicated array member case
mdadm prevents creation when device names are duplicated on the command
line, but leaves the partially created array intact. Detect this case
in the error code from add_to_super() and cleanup the partially created
array. The imsm handler is updated to report this conflict in
add_to_super_imsm_volume().
Note that since neither mdmon, nor userspace for that matter, ever saw an
active array we only need to perform a subset of the cleanup actions.
So call ioctl(STOP_ARRAY) directly and arrange for Create() to cleanup
the map file rather than calling Manage_runstop().
Reported-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
Create.c | 10 ++++++++--
Manage.c | 8 +++-----
mapfile.c | 10 ++++++++++
mdadm.h | 1 +
super-intel.c | 11 ++++++++++-
5 files changed, 32 insertions(+), 8 deletions(-)
--- mdadm-3.0.3.orig/Create.c
+++ mdadm-3.0.3/Create.c
@@ -755,8 +755,10 @@ int Create(struct supertype *st, char *m
if (fd >= 0)
remove_partitions(fd);
if (st->ss->add_to_super(st, &inf->disk,
- fd, dv->devname))
+ fd, dv->devname)) {
+ ioctl(mdfd, STOP_ARRAY, NULL);
goto abort;
+ }
st->ss->getinfo_super(st, inf);
safe_mode_delay = inf->safe_mode_delay;
@@ -860,7 +862,7 @@ int Create(struct supertype *st, char *m
if (ioctl(mdfd, RUN_ARRAY, &param)) {
fprintf(stderr, Name ": RUN_ARRAY failed: %s\n",
strerror(errno));
- Manage_runstop(mddev, mdfd, -1, 0);
+ ioctl(mdfd, STOP_ARRAY, NULL);
goto abort;
}
}
@@ -881,6 +883,10 @@ int Create(struct supertype *st, char *m
return 0;
abort:
+ map_lock(&map);
+ map_remove(&map, fd2devnum(mdfd));
+ map_unlock(&map);
+
if (mdfd >= 0)
close(mdfd);
return 1;
--- mdadm-3.0.3.orig/Manage.c
+++ mdadm-3.0.3/Manage.c
@@ -277,11 +277,9 @@ int Manage_runstop(char *devname, int fd
if (quiet <= 0)
fprintf(stderr, Name ": stopped %s\n", devname);
- if (devnum != NoMdDev) {
- map_delete(&map, devnum);
- map_write(map);
- map_free(map);
- }
+ map_lock(&map);
+ map_remove(&map, devnum);
+ map_unlock(&map);
}
return 0;
}
--- mdadm-3.0.3.orig/mapfile.c
+++ mdadm-3.0.3/mapfile.c
@@ -239,6 +239,16 @@ void map_delete(struct map_ent **mapp, i
}
}
+void map_remove(struct map_ent **mapp, int devnum)
+{
+ if (devnum == NoMdDev)
+ return;
+
+ map_delete(mapp, devnum);
+ map_write(*mapp);
+ map_free(*mapp);
+}
+
struct map_ent *map_by_uuid(struct map_ent **map, int uuid[4])
{
struct map_ent *mp;
--- mdadm-3.0.3.orig/mdadm.h
+++ mdadm-3.0.3/mdadm.h
@@ -324,6 +324,7 @@ struct map_ent {
};
extern int map_update(struct map_ent **mpp, int devnum, char *metadata,
int uuid[4], char *path);
+extern void map_remove(struct map_ent **map, int devnum);
extern struct map_ent *map_by_uuid(struct map_ent **map, int uuid[4]);
extern struct map_ent *map_by_devnum(struct map_ent **map, int devnum);
extern struct map_ent *map_by_name(struct map_ent **map, char *name);
--- mdadm-3.0.3.orig/super-intel.c
+++ mdadm-3.0.3/super-intel.c
@@ -2817,7 +2817,7 @@ static int init_super_imsm_volume(struct
map->num_members = info->raid_disks;
for (i = 0; i < map->num_members; i++) {
/* initialized in add_to_super */
- set_imsm_ord_tbl_ent(map, i, 0);
+ set_imsm_ord_tbl_ent(map, i, IMSM_ORD_REBUILD);
}
mpb->num_raid_devs++;
@@ -2895,6 +2895,7 @@ static int add_to_super_imsm_volume(stru
struct dl *dl;
struct imsm_dev *dev;
struct imsm_map *map;
+ int slot;
dev = get_imsm_dev(super, super->current_vol);
map = get_imsm_map(dev, 0);
@@ -2929,6 +2930,14 @@ static int add_to_super_imsm_volume(stru
dl->index = super->anchor->num_disks;
super->anchor->num_disks++;
}
+ /* Check the device has not already been added */
+ slot = get_imsm_disk_slot(map, dl->index);
+ if (slot >= 0 &&
+ (get_imsm_ord_tbl_ent(dev, slot) & IMSM_ORD_REBUILD) == 0) {
+ fprintf(stderr, Name ": %s has been included in this array twice\n",
+ devname);
+ return 1;
+ }
set_imsm_ord_tbl_ent(map, dk->number, dl->index);
dl->disk.status = CONFIGURED_DISK;

View File

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

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

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

View File

@ -1,3 +1,28 @@
-------------------------------------------------------------------
Thu Oct 21 18:01:14 CEST 2010 - ro@suse.de
- update to 3.1.4
- Support --grow to change the layout of RAID4/5/6
- Support --grow to change the chunksize of raid 4/5/6
- Support --grow to change level from RAID1 -> RAID5 -> RAID6 and
back.
- Support --grow to reduce the number of devices in RAID4/5/6.
- Support restart of these grow options which assembling an array
which is partially grown.
- Assorted tests of this code, and of different RAID6 layouts.
- The default metadata is now v1.2
- The default chunksize is now 512K rather than 64K. This seems more
appropriate for modern devices.
- The default bitmap chunksize for internal bitmaps is now at least
64Meg as fine grained bitmaps tend to impact performance more for
little extra gain.
- Alway make bitmap 4K-aligned if at all possible.
- removed patches:
- bitmap-4k-boundary.patch (obsolete/upstream)
- fix-dup.patch (obsolete/upstream)
- IMSM-part.patch (obsolete/upstream)
- container-argv-check (obsolete/upstream)
-------------------------------------------------------------------
Mon Jun 28 06:38:35 UTC 2010 - jengelh@medozas.de

View File

@ -1,5 +1,5 @@
#
# spec file for package mdadm (Version 3.0.3)
# spec file for package mdadm (Version 3.1.4)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -19,7 +19,7 @@
Name: mdadm
Version: 3.0.3
Version: 3.1.4
Release: 8
BuildRequires: sgmltool
PreReq: %fillup_prereq %insserv_prereq
@ -38,11 +38,8 @@ Source4: boot.md
Source5: mkinitrd-setup.sh
Source6: mkinitrd-boot.sh
Source7: 64-md-raid.rules
Patch1: bitmap-4k-boundary.patch
# PATCH-FIX-OPENSUSE Fix crash if /proc/mdstat lists 0.9 superblocks (should be upstreamed)
Patch2: mdmon-0.9-superblock-crash.patch
Patch3: fix-dup.patch
Patch4: IMSM-part.patch
Patch5: container-argv-check
%description
Mdadm is a program that can be used to control Linux md devices. It is
@ -57,11 +54,7 @@ Authors:
%prep
%setup -q -a1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
%{suse_update_config -f}

View File

@ -4,14 +4,11 @@ Date: Fri, 19 Mar 2010 11:59:20 +0100
Subject: [PATCH] mdmon: Fix crash if /proc/mdstat lists 0.9 superblocks
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
mdmon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- mdadm-3.0.3.orig/mdmon.c
+++ mdadm-3.0.3/mdmon.c
@@ -313,7 +313,8 @@ int main(int argc, char *argv[])
scan = 1;
================================================================================
--- mdadm-3.1.4/mdmon.c
+++ mdadm-3.1.4/mdmon.c
@@ -300,7 +300,8 @@
/* launch an mdmon instance for each container found */
mdstat = mdstat_read(0, 0);
for (e = mdstat; e; e = e->next) {
- if (strncmp(e->metadata_version, "external:", 9) == 0 &&