Compare commits

..

3 commits

Author SHA1 Message Date
Xiao Ni
82fff1474c Fix Degraded Raid1 array becomes inactive after rebooting
Resolves: bz#1337003

Signed-off-by: Xiao Ni <xni@redhat.com>
2016-05-30 23:54:49 +08:00
Jes Sorensen
17c08f7784 Fix race when assembling or stopping IMSM RAID arrays
Resolves: bz#1268955

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
2015-10-05 13:56:02 -04:00
Jes Sorensen
0950fd8f81 Upgrade to mdadm-3.3.4
Resolves: bz#1246474

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
2015-10-05 13:32:13 -04:00
32 changed files with 1007 additions and 1041 deletions

19
.gitignore vendored
View file

@ -1,6 +1,21 @@
mdadm-3.0.3.tar.bz2
mdadm-3.1.1-gcd9a8b5.tar.bz2
mdadm-3.1.2.tar.bz2
mdadm-3.1.3-git07202010.tar.bz2
mdadm-3.1.3-git20100722.tar.bz2
mdadm-3.1.3-git20100804.tar.bz2
mdadm-3.1.5.tar.bz2
.build*
clog
*.src.rpm
*/
/mdadm-4.*.tar.xz
/mdadm-4.3.tar.sign
/mdadm-3.2.1.tar.bz2
/mdadm-3.2.2.tar.bz2
/mdadm-3.2.3.tar.bz2
/mdadm-3.2.4.tar.xz
/mdadm-3.2.5.tar.xz
/mdadm-3.2.6.tar.xz
/mdadm-3.3.tar.xz
/mdadm-3.3.1.tar.xz
/mdadm-3.3.2.tar.xz
/mdadm-3.3.4.tar.xz

View file

@ -1,428 +0,0 @@
From 857ad175fe025f026a1173e38de0b482110fdce5 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Sun, 6 Apr 2025 14:13:45 -0700
Subject: [PATCH] Revert "mdadm: Follow POSIX Portable Character Set"
This reverts commit e2eb503bd797908f515b58428b274f1ba6a05349.
---
Detail.c | 17 +++++++-----
config.c | 13 +++------
lib.c | 58 +++++++++++-----------------------------
mdadm.8.in | 70 ++++++++++++++++++++++++++++---------------------
mdadm.conf.5.in | 4 +++
mdadm.h | 2 +-
super-intel.c | 47 +++++++++++++++++----------------
7 files changed, 100 insertions(+), 111 deletions(-)
diff --git a/Detail.c b/Detail.c
index aaa3dd6e..6d675152 100644
--- a/Detail.c
+++ b/Detail.c
@@ -254,9 +254,11 @@ int Detail(char *dev, struct context *c)
fname_from_uuid(st, info, nbuf, ':');
printf("MD_UUID=%s\n", nbuf + 5);
mp = map_by_uuid(&map, info->uuid);
-
- if (mp && mp->path && strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0)
- printf("MD_DEVNAME=%s\n", mp->path + DEV_MD_DIR_LEN);
+ if (mp && mp->path && strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0) {
+ printf("MD_DEVNAME=");
+ print_escape(mp->path + DEV_MD_DIR_LEN);
+ putchar('\n');
+ }
if (st->ss->export_detail_super)
st->ss->export_detail_super(st);
@@ -269,9 +271,12 @@ int Detail(char *dev, struct context *c)
__fname_from_uuid(mp->uuid, 0, nbuf, ':');
printf("MD_UUID=%s\n", nbuf+5);
}
- if (mp && mp->path && strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0)
- printf("MD_DEVNAME=%s\n", mp->path + DEV_MD_DIR_LEN);
-
+ if (mp && mp->path &&
+ strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0) {
+ printf("MD_DEVNAME=");
+ print_escape(mp->path + DEV_MD_DIR_LEN);
+ putchar('\n');
+ }
map_free(map);
}
if (!c->no_devices && sra) {
diff --git a/config.c b/config.c
index 44f7dd2f..0a80eedb 100644
--- a/config.c
+++ b/config.c
@@ -199,9 +199,9 @@ inline void ident_init(struct mddev_ident *ident)
* /dev/md_d{number} (legacy)
* /dev/md_{name}
* /dev/md/{name}
- * {name}
+ * {name} - anything that doesn't start from '/' or '<'.
*
- * {name} must follow name's criteria and be POSIX compatible.
+ * {name} must follow name's criteria.
* If criteria passed, duplicate memory and set devname in @ident.
*
* Return: %MDADM_STATUS_SUCCESS or %MDADM_STATUS_ERROR.
@@ -241,8 +241,8 @@ mdadm_status_t _ident_set_devname(struct mddev_ident *ident, const char *devname
else
name = devname;
- if (is_name_posix_compatible(name) == false) {
- ident_log(prop_name, name, "Not POSIX compatible", cmdline);
+ if (*name == '/' || *name == '<') {
+ ident_log(prop_name, devname, "Cannot be started from \'/\' or \'<\'", cmdline);
return MDADM_STATUS_ERROR;
}
@@ -284,11 +284,6 @@ static mdadm_status_t _ident_set_name(struct mddev_ident *ident, const char *nam
return MDADM_STATUS_ERROR;
}
- if (is_name_posix_compatible(name) == false) {
- ident_log(prop_name, name, "Not POSIX compatible", cmdline);
- return MDADM_STATUS_ERROR;
- }
-
snprintf(ident->name, MD_NAME_MAX + 1, "%s", name);
return MDADM_STATUS_SUCCESS;
}
diff --git a/lib.c b/lib.c
index 2b09293c..95e3511f 100644
--- a/lib.c
+++ b/lib.c
@@ -454,50 +454,24 @@ void print_quoted(char *str)
putchar(q);
}
-/**
- * is_alphanum() - Check if sign is letter or digit.
- * @c: char to analyze.
- *
- * Similar to isalnum() but additional locales are excluded.
- *
- * Return: %true on success, %false otherwise.
- */
-bool is_alphanum(const char c)
-{
- if (isupper(c) || islower(c) || isdigit(c) != 0)
- return true;
- return false;
-}
-
-/**
- * is_name_posix_compatible() - Check if name is POSIX compatible.
- * @name: name to check.
- *
- * POSIX portable file name character set contains ASCII letters,
- * digits, '_', '.', and '-'. Also forbid leading '-'.
- * The length of the name cannot exceed NAME_MAX - 1 (ensure NULL ending).
- *
- * Return: %true on success, %false otherwise.
- */
-bool is_name_posix_compatible(const char * const name)
+void print_escape(char *str)
{
- assert(name);
-
- char allowed_symbols[] = "-_.";
- const char *n = name;
-
- if (!is_string_lq(name, NAME_MAX))
- return false;
-
- if (*n == '-')
- return false;
-
- while (*n != '\0') {
- if (!is_alphanum(*n) && !strchr(allowed_symbols, *n))
- return false;
- n++;
+ /* print str, but change space and tab to '_'
+ * as is suitable for device names
+ */
+ for (; *str; str++) {
+ switch (*str) {
+ case ' ':
+ case '\t':
+ putchar('_');
+ break;
+ case '/':
+ putchar('-');
+ break;
+ default:
+ putchar(*str);
+ }
}
- return true;
}
int check_env(char *name)
diff --git a/mdadm.8.in b/mdadm.8.in
index 96a4a08e..4af90c48 100644
--- a/mdadm.8.in
+++ b/mdadm.8.in
@@ -364,7 +364,7 @@ Use the Intel(R) Matrix Storage Manager metadata format. This creates a
which is managed in a similar manner to DDF, and is supported by an
option-rom on some platforms:
.IP
-.B https://www.intel.com/content/www/us/en/support/products/122484
+.B https://www.intel.com/content/www/us/en/support/products/122484/memory-and-storage/ssd-software/intel-virtual-raid-on-cpu-intel-vroc.html
.PP
.RE
@@ -932,14 +932,17 @@ option will be ignored.
.BR \-N ", " \-\-name=
Set a
.B name
-for the array. It must be
-.BR "POSIX PORTABLE NAME"
-compatible and cannot be longer than 32 chars. This is effective when creating an array
-with a v1 metadata, or an external array.
-
-If name is needed but not specified, it is taken from the basename of the device
-that is being created. See
-.BR "DEVICE NAMES"
+for the array. This is currently only effective when creating an
+array with a version-1 superblock, or an array in a DDF container.
+The name is a simple textual string that can be used to identify array
+components when assembling. If name is needed but not specified, it
+is taken from the basename of the device that is being created.
+e.g. when creating
+.I /dev/md/home
+the
+.B name
+will default to
+.IR home .
.TP
.BR \-R ", " \-\-run
@@ -1129,10 +1132,8 @@ is much safer.
.TP
.BR \-N ", " \-\-name=
-Specify the name of the array to assemble. It must be
-.BR "POSIX PORTABLE NAME"
-compatible and cannot be longer than 32 chars. This must be the name
-that was specified when creating the array. It must either match
+Specify the name of the array to assemble. This must be the name
+that was specified when creating the array. It must either match
the name stored in the superblock exactly, or it must match
with the current
.I homehost
@@ -2178,17 +2179,14 @@ Usage:
.I md-device
.BI \-\-chunk= X
.BI \-\-level= Y
+.br
.BI \-\-raid\-devices= Z
.I devices
.PP
-This usage will initialize a new md array, associate some devices with
+This usage will initialise a new md array, associate some devices with
it, and activate the array.
-.I md-device
-is a new device. This could be standard name or chosen name. For details see:
-.BR "DEVICE NAMES"
-
The named device will normally not exist when
.I "mdadm \-\-create"
is run, but will be created by
@@ -2229,6 +2227,24 @@ array. This feature can be overridden with the
.B \-\-force
option.
+When creating an array with version-1 metadata a name for the array is
+required.
+If this is not given with the
+.B \-\-name
+option,
+.I mdadm
+will choose a name based on the last component of the name of the
+device being created. So if
+.B /dev/md3
+is being created, then the name
+.B 3
+will be chosen.
+If
+.B /dev/md/home
+is being created, then the name
+.B home
+will be used.
+
When creating a partition based array, using
.I mdadm
with version-1.x metadata, the partition type should be set to
@@ -2413,10 +2429,12 @@ and
The
.B name
-option updates the subarray name in the metadata. It must be
-.BR "POSIX PORTABLE NAME"
-compatible and cannot be longer than 32 chars. If successes, new value will be respected after
-next assembly.
+option updates the subarray name in the metadata, it may not affect the
+device node name or the device node symlink until the subarray is
+re\-assembled. If updating
+.B name
+would change the UUID of an active subarray this operation is blocked,
+and the command will end in an error.
The
.B ppl
@@ -3377,10 +3395,6 @@ When
.B \-\-incremental
mode is used, this file gets a list of arrays currently being created.
-.SH POSIX PORTABLE NAME
-A valid name can only consist of characters "A-Za-z0-9.-_".
-The name cannot start with a leading "-" and cannot exceed 255 chars.
-
.SH DEVICE NAMES
.I mdadm
@@ -3402,10 +3416,6 @@ can be given, or just the suffix of the second sort of name, such as
.I home
can be given.
-In every style, raw name must be compatible with
-.BR "POSIX PORTABLE NAME"
-and has to be no longer than 32 chars.
-
When
.I mdadm
chooses device names during auto-assembly or incremental assembly, it
diff --git a/mdadm.conf.5.in b/mdadm.conf.5.in
index 787e51e9..032b8010 100644
--- a/mdadm.conf.5.in
+++ b/mdadm.conf.5.in
@@ -710,6 +710,10 @@ ARRAY /dev/md/home UUID=9187a482:5dde19d9:eea3cc4a:d646ab8b
.br
auto=part
.br
+# The name of this array contains a space.
+.br
+ARRAY /dev/md9 name='Data Storage'
+.sp
POLICY domain=domain1 metadata=imsm path=pci-0000:00:1f.2-scsi-*
.br
action=spare
diff --git a/mdadm.h b/mdadm.h
index 1f28b3e7..3b3168d4 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1623,7 +1623,6 @@ extern int check_raid(int fd, char *name);
extern int check_partitions(int fd, char *dname,
unsigned long long freesize,
unsigned long long size);
-extern bool is_name_posix_compatible(const char *path);
extern int fstat_is_blkdev(int fd, char *devname, dev_t *rdev);
extern int stat_is_blkdev(char *devname, dev_t *rdev);
@@ -1664,6 +1663,7 @@ extern int conf_get_monitor_delay(void);
extern char *conf_line(FILE *file);
extern char *conf_word(FILE *file, int allow_key);
extern void print_quoted(char *str);
+extern void print_escape(char *str);
extern int use_udev(void);
extern void print_escape(char *str);
extern unsigned long GCD(unsigned long a, unsigned long b);
diff --git a/super-intel.c b/super-intel.c
index dbea235d..33f1469f 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -5533,37 +5533,40 @@ static void imsm_update_version_info(struct intel_super *super)
}
}
-/**
- * imsm_check_name() - check imsm naming criteria.
- * @super: &intel_super pointer, not NULL.
- * @name: name to check.
- * @verbose: verbose level.
- *
- * Name must be no longer than &MAX_RAID_SERIAL_LEN and must be unique across volumes.
- *
- * Returns: &true if @name matches, &false otherwise.
- */
-static bool imsm_is_name_allowed(struct intel_super *super, const char * const name,
- const int verbose)
+static int check_name(struct intel_super *super, char *name, int quiet)
{
struct imsm_super *mpb = super->anchor;
+ char *reason = NULL;
+ char *start = name;
+ size_t len = strlen(name);
int i;
- if (is_string_lq(name, MAX_RAID_SERIAL_LEN + 1) == false) {
- pr_vrb("imsm: Name \"%s\" is too long\n", name);
- return false;
+ if (len > 0) {
+ while (isspace(start[len - 1]))
+ start[--len] = 0;
+ while (*start && isspace(*start))
+ ++start, --len;
+ memmove(name, start, len + 1);
}
+ if (len > MAX_RAID_SERIAL_LEN)
+ reason = "must be 16 characters or less";
+ else if (len == 0)
+ reason = "must be a non-empty string";
+
for (i = 0; i < mpb->num_raid_devs; i++) {
struct imsm_dev *dev = get_imsm_dev(super, i);
if (strncmp((char *) dev->volume, name, MAX_RAID_SERIAL_LEN) == 0) {
- pr_vrb("imsm: Name \"%s\" already exists\n", name);
- return false;
+ reason = "already exists";
+ break;
}
}
- return true;
+ if (reason && !quiet)
+ pr_err("imsm volume name %s\n", reason);
+
+ return !reason;
}
static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
@@ -5658,9 +5661,8 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
}
}
- if (imsm_is_name_allowed(super, name, 1) == false)
+ if (!check_name(super, name, 0))
return 0;
-
dv = xmalloc(sizeof(*dv));
dev = xcalloc(1, sizeof(*dev) + sizeof(__u32) * (info->raid_disks - 1));
/*
@@ -7988,7 +7990,7 @@ static int update_subarray_imsm(struct supertype *st, char *subarray,
char *ep;
int vol;
- if (imsm_is_name_allowed(super, name, 1) == false)
+ if (!check_name(super, name, 0))
return 2;
vol = strtoul(subarray, &ep, 10);
@@ -10298,8 +10300,7 @@ static void imsm_process_update(struct supertype *st,
if (a->info.container_member == target)
break;
dev = get_imsm_dev(super, u->dev_idx);
-
- if (a || !dev || imsm_is_name_allowed(super, name, 0) == false) {
+ if (a || !check_name(super, name, 1)) {
dprintf("failed to rename subarray-%d\n", target);
break;
}
--
2.49.0

View file

@ -1,11 +0,0 @@
--- a/Assemble.c~ 2025-08-13 22:05:00.416132027 -0400
+++ b/Assemble.c 2025-08-13 22:13:16.650837070 -0400
@@ -1597,8 +1597,6 @@
goto try_again;
goto out;
}
- /* just incase it was started but has no content */
- ioctl(mdfd, STOP_ARRAY, NULL);
}
if (content != &info) {

View file

@ -1,72 +0,0 @@
pub rsa2048 2023-11-03 [SC]
EED84966493AEEAF4B466F696F9E3E9D4EDEBB11
uid Mariusz Tkaczyk (First Key) <mariusz.tkaczyk@linux.intel.com>
sub rsa2048 2023-11-03 [E]
F07BC7F109D51D72E3A4B8779CF5038718DB4BA7
sub ed25519 2023-11-03 [S]
A2320B82F9D51E3BB0E2B3B201C8BB2357D15E24
-----BEGIN PGP PUBLIC KEY BLOCK-----
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
=PmkW
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -1,7 +1,7 @@
--- mdadm-3.2.1/Makefile.static 2021-01-11 15:46:47.292126848 +0800
+++ mdadm-3.2.1/Makefile 2021-01-11 15:46:10.720192519 +0800
@@ -248,16 +248,16 @@
install : install-bin install-man install-udev
--- mdadm-3.2.1/Makefile.static 2011-03-27 22:31:20.000000000 -0400
+++ mdadm-3.2.1/Makefile 2011-03-28 10:16:55.277900184 -0400
@@ -238,16 +238,16 @@ install : mdadm mdmon install-man instal
$(INSTALL) -D $(STRIP) -m 755 mdmon $(DESTDIR)$(BINDIR)/mdmon
install-static : mdadm.static install-man
- $(INSTALL) -D $(STRIP) -m 755 mdadm.static $(DESTDIR)$(BINDIR)/mdadm

18
mdadm-3.2.4-map-dir.patch Normal file
View file

@ -0,0 +1,18 @@
--- mdadm-3.2.4/Makefile.map-dir 2012-05-10 12:29:09.687578525 +0200
+++ mdadm-3.2.4/Makefile 2012-05-10 12:28:05.514380800 +0200
@@ -67,12 +67,12 @@
# Both MAP_DIR and MDMON_DIR should be somewhere that persists across the
# pivotroot from early boot to late boot.
# /run is best, but for distros that don't support that, /dev can work.
-MAP_DIR=/run/mdadm
-MAP_FILE = map
+MAP_DIR=/dev/md
+MAP_FILE = md-device-map
MAP_PATH = $(MAP_DIR)/$(MAP_FILE)
MDMON_DIR = $(MAP_DIR)
# place for autoreplace cookies
-FAILED_SLOTS_DIR = /run/mdadm/failed-slots
+FAILED_SLOTS_DIR = $(MDMON_DIR)/failed-slots
DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"

View file

@ -0,0 +1,92 @@
From d9751e06a601b5576b1b9e2c8126584083110ca5 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Tue, 15 May 2012 09:51:03 +1000
Subject: [PATCH] super1: fix choice of data_offset.
While it is nice to set a high data_offset to leave plenty of head
room it is much more important to leave enough space to allow
of the data of the array.
So after we check that sb->size is still available, only reduce the
'reserved', don't increase it.
This fixes a bug where --adding a spare fails because it does not have
enough space in it.
Reported-by: nowhere <nowhere@hakkenden.ath.cx>
Signed-off-by: NeilBrown <neilb@suse.de>
---
super1.c | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/super1.c b/super1.c
index be77c33..4f20cc3 100644
--- a/super1.c
+++ b/super1.c
@@ -1189,40 +1189,42 @@ static int write_init_super1(struct supertype *st)
case 1:
sb->super_offset = __cpu_to_le64(0);
reserved = bm_space + 4*2;
+ if (reserved < headroom)
+ reserved = headroom;
+ if (reserved + array_size > dsize)
+ reserved = dsize - array_size;
/* Try for multiple of 1Meg so it is nicely aligned */
#define ONE_MEG (2*1024)
- reserved = ((reserved + ONE_MEG-1)/ONE_MEG) * ONE_MEG;
- if (reserved + __le64_to_cpu(sb->size) > dsize)
- reserved = dsize - __le64_to_cpu(sb->size);
+ if (reserved > ONE_MEG)
+ reserved = (reserved/ONE_MEG) * ONE_MEG;
+
/* force 4K alignment */
reserved &= ~7ULL;
- if (reserved < headroom)
- reserved = headroom;
-
sb->data_offset = __cpu_to_le64(reserved);
sb->data_size = __cpu_to_le64(dsize - reserved);
break;
case 2:
sb_offset = 4*2;
sb->super_offset = __cpu_to_le64(4*2);
- if (4*2 + 4*2 + bm_space + __le64_to_cpu(sb->size)
+ if (4*2 + 4*2 + bm_space + array_size
> dsize)
- bm_space = dsize - __le64_to_cpu(sb->size)
+ bm_space = dsize - array_size
- 4*2 - 4*2;
reserved = bm_space + 4*2 + 4*2;
+ if (reserved < headroom)
+ reserved = headroom;
+ if (reserved + array_size > dsize)
+ reserved = dsize - array_size;
/* Try for multiple of 1Meg so it is nicely aligned */
#define ONE_MEG (2*1024)
- reserved = ((reserved + ONE_MEG-1)/ONE_MEG) * ONE_MEG;
- if (reserved + __le64_to_cpu(sb->size) > dsize)
- reserved = dsize - __le64_to_cpu(sb->size);
+ if (reserved > ONE_MEG)
+ reserved = (reserved/ONE_MEG) * ONE_MEG;
+
/* force 4K alignment */
reserved &= ~7ULL;
- if (reserved < headroom)
- reserved = headroom;
-
sb->data_offset = __cpu_to_le64(reserved);
sb->data_size = __cpu_to_le64(dsize - reserved);
break;
@@ -1234,7 +1236,6 @@ static int write_init_super1(struct supertype *st)
goto out;
}
-
sb->sb_csum = calc_sb_1_csum(sb);
rv = store_super1(st, di->fd);
if (rv == 0 && (__le32_to_cpu(sb->feature_map) & 1))
--
1.7.7.6

View file

@ -0,0 +1,45 @@
From 39fe768b8d9f3bd641f98029cb33f61f0c66841b Mon Sep 17 00:00:00 2001
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Date: Wed, 3 Oct 2012 10:00:34 +0200
Subject: [PATCH 2/2] Add zlib license to crc32.c
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
crc32.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/crc32.c b/crc32.c
index 12d08e5..94fda06 100644
--- a/crc32.c
+++ b/crc32.c
@@ -2,6 +2,26 @@
* Copyright (C) 1995-2003 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*
+ * Note: zlib license from from zlib.h added explicitly as mdadm does
+ * not include zlib.h. License from v1.2.2 of zlib:
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ *
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
* CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
* tables for updating the shift register in one step with three exclusive-ors
--
1.7.11.4

View file

@ -0,0 +1,39 @@
From c0e59ebcf91e43bdf3e1dbd69a59980655e3ac38 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Wed, 3 Oct 2012 13:34:15 +1000
Subject: [PATCH 1/2] Replace sha1.h with slightly older version.
sha1.h claims GPL3+, while sha1.c claims GPL2+. This is
inconsistent and technically prevents the whole from being
distributed under GPL2.
So replace sha1.h with a version from the GCC sources from before
Tue Apr 20 08:36:39 2010
when the copyright notice was updated.
Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
sha1.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sha1.h b/sha1.h
index a601d96..d9b07f8 100644
--- a/sha1.h
+++ b/sha1.h
@@ -1,11 +1,11 @@
/* Declarations of functions and data types used for SHA1 sum
library functions.
- Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008, 2010
+ Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any
+ Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
--
1.7.11.4

View file

@ -0,0 +1,46 @@
From e1993023991a6fa6539cc604b4b3d6718833250d Mon Sep 17 00:00:00 2001
From: Lukasz Dorau <lukasz.dorau@intel.com>
Date: Fri, 25 May 2012 15:06:41 +0200
Subject: [PATCH] imsm: fix: correct checking volume's degradation
We do not check the return value of sysfs_get_ll() now. It is wrong.
If reading of the sysfs "degraded" key does not succeed,
the "new_degraded" variable will not be initiated
and accidentally it can have the value of "degraded" variable.
In that case the change of degradation will not be checked.
It happens if mdadm is compiled with gcc's "-fstack-protector" option
when one tries to stop a volume under reshape (e.g. OLCE).
Reshape seems to be finished then (metadata is in normal/clean state)
but it is not finished, it is broken and data are corrupted.
Now we always check the return value of sysfs_get_ll().
Even if reading of the sysfs "degraded" key does not succeed
(rv == -1) the change of degradation will be checked.
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
super-intel.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 6c87e20..07ab9ae 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -10370,8 +10370,10 @@ int check_degradation_change(struct mdinfo *info,
int degraded)
{
unsigned long long new_degraded;
- sysfs_get_ll(info, NULL, "degraded", &new_degraded);
- if (new_degraded != (unsigned long long)degraded) {
+ int rv;
+
+ rv = sysfs_get_ll(info, NULL, "degraded", &new_degraded);
+ if ((rv == -1) || (new_degraded != (unsigned long long)degraded)) {
/* check each device to ensure it is still working */
struct mdinfo *sd;
new_degraded = 0;
--
1.7.10.2

View file

@ -0,0 +1,49 @@
From 4edb8530e889fc7b5e1b5471a0fbfd6c3c116b4a Mon Sep 17 00:00:00 2001
From: Pawel Baldysiak <pawel.baldysiak@intel.com>
Date: Wed, 3 Apr 2013 12:43:42 +1100
Subject: [PATCH] Add updating component_size to manager thread of mdmon
Mdmon does not update component_size now. It is wrong because in case
of size's expansion component_size is changed by mdadm but mdmon does not
reread its new value and uses a wrong, old one. As a result the metadata
is incorrect during size's expansion. It contains no information that
resync is in progress (there is no checkpoint too). The metadata is
as if resync has already been finished but it has not.
Component_size will be set to match information in sysfs. This value
will be updated by manager thread in manage_member() function.
Now mdmon uses the correct, current value of component_size and the
correct metadata (containing information about resync and checkpoint)
is written.
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
managemon.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/managemon.c b/managemon.c
index d155b04..2c55b3c 100644
--- a/managemon.c
+++ b/managemon.c
@@ -444,6 +444,7 @@ static void manage_member(struct mdstat_ent *mdstat,
char buf[64];
int frozen;
struct supertype *container = a->container;
+ unsigned long long int component_size = 0;
if (container == NULL)
/* Raced with something */
@@ -453,6 +454,9 @@ static void manage_member(struct mdstat_ent *mdstat,
a->info.array.raid_disks = mdstat->raid_disks;
// MORE
+ if (sysfs_get_ll(&a->info, NULL, "component_size", &component_size) >= 0)
+ a->info.component_size = component_size << 1;
+
/* honor 'frozen' */
if (sysfs_get_str(&a->info, NULL, "metadata_version", buf, sizeof(buf)) > 0)
frozen = buf[9] == '-';
--
1.8.1.4

View file

@ -0,0 +1,30 @@
From 066e92f017df22c879c455494d2c1743ef7f3aca Mon Sep 17 00:00:00 2001
From: Lukasz Dorau <lukasz.dorau@intel.com>
Date: Fri, 16 Nov 2012 17:24:36 +0100
Subject: [PATCH] Create.c: check if freesize is equal 0
"freesize" can be equal 0, particularly after rounding to the chunk's size.
Creating should be aborted in such case.
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
Create.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Create.c b/Create.c
index afcf1a5..436bd1d 100644
--- a/Create.c
+++ b/Create.c
@@ -407,6 +407,11 @@
do_default_chunk = 0;
}
}
+ if (!freesize) {
+ fprintf(stderr, Name ": no free space left on %s\n", dname);
+ fail = 1;
+ continue;
+ }
if (size && freesize < size) {
fprintf(stderr, Name ": %s is smaller than given size."

View file

@ -0,0 +1,54 @@
From 2fdf559d74a48806900b63f1b4504a18dec048a9 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Mon, 22 Apr 2013 17:05:33 +1000
Subject: [PATCH] Manage_runstop: call flush_mdmon if O_EXCL fails on stopping
mdmon array.
When stopping an mdmon array, at reshape might be being aborted
which inhibets O_EXCL. So if that is possible, call flush_mdmon
to make sure mdmon isn't still busy.
Reported-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
Manage.c | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/Manage.c b/Manage.c
index e3d3041..e37f415 100644
--- a/Manage.c
+++ b/Manage.c
@@ -221,8 +222,19 @@ int Manage_runstop(char *devname, int fd, int runstop,
/* Get EXCL access first. If this fails, then attempting
* to stop is probably a bad idea.
*/
- close(fd);
- fd = open(devname, O_RDONLY|O_EXCL);
+ mdi = sysfs_read(fd, -1, GET_LEVEL|GET_VERSION);
+ close(fd);
+ count = 5;
+ while (((fd = open(devname, O_RDONLY|O_EXCL)) < 0
+ || fd2devnum(fd) != devnum)
+ && mdi && !is_subarray(mdi->text_version)
+ && mdmon_running(devname2devnum(mdi->sys_name))
+ && count) {
+ if (fd >= 0)
+ close(fd);
+ flush_mdmon(mdi->sys_name);
+ count--;
+ }
if (fd < 0 || fd2devnum(fd) != devnum) {
if (fd >= 0)
close(fd);
@@ -237,7 +257,6 @@ int Manage_runstop(char *devname, int fd, int runstop,
devname);
return 1;
}
- mdi = sysfs_read(fd, -1, GET_LEVEL|GET_VERSION);
if (mdi &&
mdi->array.level > 0 &&
is_subarray(mdi->text_version)) {
--
1.8.3.1

View file

@ -0,0 +1,73 @@
From 3c309c82699ae3bebc716dbd5abea079dd41184a Mon Sep 17 00:00:00 2001
From: Marcin Tomczak <marcin.tomczak@intel.com>
Date: Fri, 9 Nov 2012 15:46:36 +0100
Subject: [PATCH] imsm: Forbid spanning between multiple controllers.
Attaching disks to multiple controllers of the same type has been
allowed so far. Now spanning between multiple controllers is disallowed
at all by IMSM metadata.
Signed-off-by: Marcin Tomczak <marcin.tomczak@intel.com>
Reviewed-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
super-intel.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 202b83f..4ac9d42 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -558,20 +558,11 @@ static int attach_hba_to_super(struct intel_super *super, struct sys_dev *device
if (super->hba == NULL) {
super->hba = alloc_intel_hba(device);
return 1;
- }
-
- hba = super->hba;
- /* Intel metadata allows for all disks attached to the same type HBA.
- * Do not sypport odf HBA types mixing
- */
- if (device->type != hba->type)
+ } else
+ /* IMSM metadata disallows to attach disks to multiple
+ * controllers.
+ */
return 2;
-
- while (hba->next)
- hba = hba->next;
-
- hba->next = alloc_intel_hba(device);
- return 1;
}
static struct sys_dev* find_disk_attached_hba(int fd, const char *devname)
@@ -3073,11 +3064,11 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst)
*/
if (!check_env("IMSM_NO_PLATFORM")) {
- if (!first->hba || !sec->hba ||
- (first->hba->type != sec->hba->type)) {
+ if (first->hba && sec->hba &&
+ strcmp(first->hba->path, sec->hba->path) != 0) {
fprintf(stderr,
"HBAs of devices does not match %s != %s\n",
- first->hba ? get_sys_dev_type(first->hba->type) : NULL,
- sec->hba ? get_sys_dev_type(sec->hba->type) : NULL);
+ first->hba ? first->hba->path : NULL,
+ sec->hba ? sec->hba->path : NULL);
return 3;
}
}
@@ -3819,7 +3810,7 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de
}
fprintf(stderr, ").\n"
- " Mixing devices attached to different controllers "
+ " Mixing devices attached to multiple controllers "
"is not allowed.\n");
}
free_sys_dev(&hba_name);
--
1.7.11.7

View file

@ -0,0 +1,49 @@
From 79b68f1b48b0967da999945e310aef628c9bca4c Mon Sep 17 00:00:00 2001
From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Date: Thu, 18 Apr 2013 10:51:37 +0200
Subject: [PATCH] imsm: monitor: do not finish migration if there are no failed
disks
Transition from "degraded" to "recovery" made in OROM is slightly different
than the same transision in mdadm. Missing disk is not removed from list of
raid devices, but just from map. Therefore mdadm should not end migration
basing on existence of list of missing disks but should rely on count of
failed disks.
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Tested-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
super-intel.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/super-intel.c b/super-intel.c
index 24016b7..3f15b0f 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -6886,6 +6886,12 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev)
if (!super->missing)
return;
+ /* When orom adds replacement for missing disk it does
+ * not remove entry of missing disk, but just updates map with
+ * new added disk. So it is not enough just to test if there is
+ * any missing disk, we have to look if there are any failed disks
+ * in map to stop migration */
+
dprintf("imsm: mark missing\n");
/* end process for initialization and rebuild only
*/
@@ -6896,7 +6902,8 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev)
failed = imsm_count_failed(super, dev, MAP_0);
map_state = imsm_check_degraded(super, dev, failed, MAP_0);
- end_migration(dev, super, map_state);
+ if (failed)
+ end_migration(dev, super, map_state);
}
for (dl = super->missing; dl; dl = dl->next)
mark_missing(dev, &dl->disk, dl->index);
--
1.8.1.4

View file

@ -0,0 +1,54 @@
From fa0d79e2b2642a2f8b04d34dfef866dbabc69e1e Mon Sep 17 00:00:00 2001
From: Samuli Suominen <ssuominen@gentoo.org>
Date: Mon, 13 Aug 2012 13:44:22 -0400
Subject: [PATCH] query udev dir via pkg-config
Since udev is moving its internal dir around, query it via pkg-config
rather than hardcoding the old path. This should work with new/old
versions.
Signed-off-by: Samuli Suominen <ssuominen@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: NeilBrown <neilb@suse.de>
---
Makefile | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 72f609e..a3e4027 100644
--- a/Makefile
+++ b/Makefile
@@ -57,6 +57,8 @@ else
DEFAULT_METADATA=1.2
endif
+PKG_CONFIG ?= pkg-config
+
SYSCONFDIR = /etc
CONFFILE = $(SYSCONFDIR)/mdadm.conf
CONFFILE2 = $(SYSCONFDIR)/mdadm/mdadm.conf
@@ -96,6 +98,11 @@ MAN4DIR = $(MANDIR)/man4
MAN5DIR = $(MANDIR)/man5
MAN8DIR = $(MANDIR)/man8
+UDEVDIR := $(shell $(PKG_CONFIG) --variable=udevdir udev 2>/dev/null)
+ifndef UDEVDIR
+ UDEVDIR = /lib/udev
+endif
+
OBJS = mdadm.o config.o policy.o mdstat.o ReadMe.o util.o maps.o lib.o \
Manage.o Assemble.o Build.o \
Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \
@@ -255,7 +262,7 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
$(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
install-udev: udev-md-raid.rules
- $(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)/lib/udev/rules.d/64-md-raid.rules
+ $(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)$(UDEVDIR)/rules.d/64-md-raid.rules
uninstall:
rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 $(DESTDIR)$(MAN8DIR)/mdmon.8 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm
--
1.8.1.4

View file

@ -1,5 +1,5 @@
--- mdadm/udev-md-raid-assembly.rules~ 2018-07-09 18:24:27.450774446 +0800
+++ mdadm/udev-md-raid-assembly.rules 2018-07-09 18:25:12.630735637 +0800
--- mdadm-3.3.1/udev-md-raid-assembly.rules~ 2014-06-10 13:29:41.192829830 +0200
+++ mdadm-3.3.1/udev-md-raid-assembly.rules 2014-06-10 13:30:20.838613208 +0200
@@ -5,6 +5,10 @@
ENV{ANACONDA}=="?*", GOTO="md_inc_end"
# assemble md arrays
@ -10,4 +10,4 @@
+
SUBSYSTEM!="block", GOTO="md_inc_end"
# skip non-initialized devices
# handle potential components of arrays (the ones supported by md)

View file

@ -0,0 +1,85 @@
From 5141638c54535b4ac80b8481404d868a63a18ecd Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Tue, 29 Jul 2014 13:48:23 +1000
Subject: [PATCH] Assemble: Only fail auto-assemble in face of mdadm.conf
conflicts.
We should never auto-assemble things that conflict with mdadm.conf
However explicit assembly requests should be allowed.
Reported-by: olovopb
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1070245
Signed-off-by: NeilBrown <neilb@suse.de>
---
Assemble.c | 47 ++++++++++++++++++++++++++---------------------
1 file changed, 26 insertions(+), 21 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index aca28be..cdcdb0f 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -366,9 +366,6 @@ static int select_devices(struct mddev_dev *devlist,
tmpdev = NULL;
goto loop;
} else {
- int rv = 0;
- struct mddev_ident *match;
-
content = *contentp;
tst->ss->getinfo_super(tst, content, NULL);
@@ -377,25 +374,33 @@ static int select_devices(struct mddev_dev *devlist,
report_mismatch ? devname : NULL))
goto loop;
- match = conf_match(tst, content, devname,
- report_mismatch ? c->verbose : -1,
- &rv);
- if (!match && rv == 2)
- goto loop;
- if (match && match->devname &&
- strcasecmp(match->devname, "<ignore>") == 0) {
- if (report_mismatch)
- pr_err("%s is a member of an explicitly ignored array\n",
- devname);
- goto loop;
- }
- if (match && !ident_matches(match, content, tst,
- c->homehost, c->update,
- report_mismatch ? devname : NULL))
- /* Array exists in mdadm.conf but some
- * details don't match, so reject it
+ if (auto_assem) {
+ /* Never auto-assemble things that conflict
+ * with mdadm.conf in some way
*/
- goto loop;
+ struct mddev_ident *match;
+ int rv = 0;
+
+ match = conf_match(tst, content, devname,
+ report_mismatch ? c->verbose : -1,
+ &rv);
+ if (!match && rv == 2)
+ goto loop;
+ if (match && match->devname &&
+ strcasecmp(match->devname, "<ignore>") == 0) {
+ if (report_mismatch)
+ pr_err("%s is a member of an explicitly ignored array\n",
+ devname);
+ goto loop;
+ }
+ if (match && !ident_matches(match, content, tst,
+ c->homehost, c->update,
+ report_mismatch ? devname : NULL))
+ /* Array exists in mdadm.conf but some
+ * details don't match, so reject it
+ */
+ goto loop;
+ }
/* should be safe to try an exclusive open now, we
* have rejected anything that some other mdadm might
--
1.9.3

View file

@ -0,0 +1,51 @@
From d13566f9b6ff8377f45cd025a1cd1a58bcb4e857 Mon Sep 17 00:00:00 2001
From: Guy Menanteau <menantea@linux.vnet.ibm.com>
Date: Mon, 4 Aug 2014 16:53:03 +0200
Subject: [PATCH] DDF: cast print arguments in super-ddf.c
mdadm fails to build on ppc64 and ppc64le architectures.
===
super-ddf.c: In function '_set_config_size':
super-ddf.c:2849:4: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' [-Werror=format=]
pr_err("%s: %x:%x: workspace size 0x%llx too big, ignoring\n",
^
super-ddf.c:2855:2: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' [-Werror=format=]
dprintf("%s: %x:%x config_size %llx, DDF structure is %llx blocks\n",
^
cc1: all warnings being treated as errors
<builtin>: recipe for target 'super-ddf.o' failed
===
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1125883
Signed-off-by: <menantea@linux.vnet.ibm.com>
Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
super-ddf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/super-ddf.c b/super-ddf.c
index 8957c2e..bc0ce2c 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -2847,13 +2847,15 @@ static void _set_config_size(struct phys_disk_entry *pde, const struct dl *dl)
__u64 wsp = cfs - t;
if (wsp > 1024*1024*2ULL && wsp > dl->size / 16) {
pr_err("%s: %x:%x: workspace size 0x%llx too big, ignoring\n",
- __func__, dl->major, dl->minor, wsp);
+ __func__, dl->major, dl->minor,
+ (unsigned long long)wsp);
} else
cfs = t;
}
pde->config_size = cpu_to_be64(cfs);
dprintf("%s: %x:%x config_size %llx, DDF structure is %llx blocks\n",
- __func__, dl->major, dl->minor, cfs, dl->size-cfs);
+ __func__, dl->major, dl->minor,
+ (unsigned long long)cfs, (unsigned long long)(dl->size-cfs));
}
/* Add a device to a container, either while creating it or while
--
1.9.3

View file

@ -0,0 +1,38 @@
From 46643e1ad5ece5f1257b2d827e36231df44929a2 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Tue, 29 Jul 2014 13:37:42 +1000
Subject: [PATCH] Grow: improve error message is "--grow -n2" used on Linear
arrays.
Linear arrays don't respond to setting raid-disks, only to
adding a device.
Reported-by: mulhern
Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1122146
Signed-off-by: NeilBrown <neilb@suse.de>
---
Grow.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Grow.c b/Grow.c
index af59347..a9c8589 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1028,7 +1028,12 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
switch (info->array.level) {
default:
- return "Cannot understand this RAID level";
+ return "No reshape is possibly for this RAID level";
+ case LEVEL_LINEAR:
+ if (info->delta_disks != UnSet)
+ return "Only --add is supported for LINEAR, setting --raid-disks is not needed";
+ else
+ return "Only --add is supported for LINEAR, other --grow options are not meaningful";
case 1:
/* RAID1 can convert to RAID1 with different disks, or
* raid5 with 2 disks, or
--
1.9.3

View file

@ -1,26 +0,0 @@
From: martin f. krafft <madduck@debian.org>
Subject: Remove -Werror from compiler flags
-Werror seems like a bad idea on released/packaged code because a toolchain
update (introducing new warnings) could break the build. We'll let upstream
use it to beautify the code, but remove it for out builds.
Signed-off-by: martin f. krafft <madduck@debian.org>
---
Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Index: mdadm-4.1/Makefile
===================================================================
--- mdadm-4.1.orig/Makefile
+++ mdadm-4.1/Makefile
@@ -48,7 +48,7 @@ endif
CC ?= $(CROSS_COMPILE)gcc
CXFLAGS ?= -ggdb
-CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter
+CWFLAGS = -Wall -Wstrict-prototypes -Wextra -Wno-unused-parameter
ifdef WARN_UNUSED
CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3
endif

3
mdadm-cron Normal file
View file

@ -0,0 +1,3 @@
# Run system wide raid-check once a week on Sunday at 1am by default
0 1 * * Sun root /usr/sbin/raid-check

View file

@ -1,26 +0,0 @@
--- mdadm/udev-md-raid-assembly.rules.orig 2023-01-06 16:37:03.780756100 +0800
+++ mdadm/udev-md-raid-assembly.rules 2023-01-06 17:04:09.536159980 +0800
@@ -5,6 +5,9 @@
ENV{ANACONDA}=="?*", GOTO="md_inc_end"
# assemble md arrays
+# Also don't process disks that are slated to be a multipath device
+ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_inc_end"
+
SUBSYSTEM!="block", GOTO="md_inc_end"
# skip non-initialized devices
@@ -33,6 +36,13 @@
LABEL="md_inc"
+# Make sure we don't handle dm devices when some limits are set.
+# And linux_raid_member only be set when change/remove event happen.
+# So we don't need to consider add event here.
+KERNEL=="dm-*", ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="md_inc_end"
+KERNEL=="dm-*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="md_inc_end"
+KERNEL=="dm-*", ENV{DM_SUSPENDED}=="1", GOTO="md_inc_end"
+
# Bare disks are ready when add event happens, the raid can be assembled.
ACTION=="change", KERNEL!="dm-*|md*", GOTO="md_inc_end"

View file

@ -1 +1 @@
d /run/mdadm 0710 root root -
d /var/run/mdadm 0710 root root -

67
mdadm.rules Normal file
View file

@ -0,0 +1,67 @@
# This file causes block devices with Linux RAID (mdadm) signatures to
# automatically cause mdadm to be run.
# See udev(8) for syntax
# Don't process any events if anaconda is running as anaconda brings up
# raid devices manually
ENV{ANACONDA}=="?*", GOTO="md_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
# We process add events on block devices (since they are ready as soon as
# they are added to the system), but we must process change events as well
# on any dm devices (like LUKS partitions or LVM logical volumes) and on
# md devices because both of these first get added, then get brought live
# and trigger a change event. The reason we don't process change events
# on bare hard disks is because if you stop all arrays on a disk, then
# run fdisk on the disk to change the partitions, when fdisk exits it
# triggers a change event, and we want to wait until all the fdisks on
# all member disks are done before we do anything. Unfortunately, we have
# no way of knowing that, so we just have to let those arrays be brought
# up manually after fdisk has been run on all of the disks.
# First, process all add events (md and dm devices will not really do
# anything here, just regular disks, and this also won't get any imsm
# array members either)
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \
IMPORT{program}="/sbin/mdadm -I $env{DEVNAME} --export $devnode --offroot ${DEVLINKS}"
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \
ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer"
SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \
ENV{ID_FS_TYPE}=="linux_raid_member", \
RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \
ENV{ID_FS_TYPE}=="linux_raid_member", \
RUN+="/sbin/mdadm -If $name"
# Next, check to make sure the BIOS raid stuff wasn't turned off via cmdline
IMPORT{cmdline}="noiswmd"
IMPORT{cmdline}="nodmraid"
ENV{noiswmd}=="?*", GOTO="md_imsm_inc_end"
ENV{nodmraid}=="?*", GOTO="md_imsm_inc_end"
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="isw_raid_member", \
RUN+="/sbin/mdadm -I $env{DEVNAME}"
SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \
ENV{ID_FS_TYPE}=="isw_raid_member", \
RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \
ENV{ID_FS_TYPE}=="isw_raid_member", \
RUN+="/sbin/mdadm -If $name"
LABEL="md_imsm_inc_end"
# Next make sure that this isn't a dm device we should skip for some reason
ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_change_end"
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_change_end"
ENV{DM_SUSPENDED}=="1", GOTO="dm_change_end"
KERNEL=="dm-*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \
ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}"
LABEL="dm_change_end"
# Finally catch any nested md raid arrays. If we brought up an md raid
# array that's part of another md raid array, it won't be ready to be used
# until the change event that occurs when it becomes live
KERNEL=="md*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \
ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}"
LABEL="md_end"

View file

@ -1,324 +1,110 @@
%bcond abrt %{undefined rhel}
Name: mdadm
Version: 4.3
Release: 9%{?dist}
Summary: The mdadm program controls Linux md devices (software RAID arrays)
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
License: GPL-2.0-or-later
Source: https://www.kernel.org/pub/linux/utils/raid/mdadm/%{name}-%{version}.tar.xz
Source1: raid-check
Source2: mdadm-raid-check-sysconfig
Source3: mdmonitor.service
Source4: mdadm.conf
Source5: mdadm_event.conf
Source6: raid-check.timer
Source7: raid-check.service
Source8: mdcheck
Source10: https://www.kernel.org/pub/linux/utils/raid/mdadm/%{name}-%{version}.tar.sign
Source11: https://git.kernel.org/pub/scm/docs/kernel/pgpkeys.git/plain/keys/6F9E3E9D4EDEBB11.asc
# https://bugzilla.redhat.com/show_bug.cgi?id=2325906
# see: https://github.com/md-raid-utilities/mdadm/pull/165
# https://github.com/md-raid-utilities/mdadm/pull/160
# https://github.com/md-raid-utilities/mdadm/pull/159
# this is a reversion of the initial 'posix check' patch
# that causes all the trouble
Patch: 0001-Revert-mdadm-Follow-POSIX-Portable-Character-Set.patch
Patch: 0002-dont-stop-in-assemble.patch
Name: mdadm
Version: 3.3.4
Release: 3%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
Source1: mdmonitor.init
Source2: raid-check
Source3: mdadm.rules
Source4: mdadm-raid-check-sysconfig
Source5: mdadm-cron
Source6: mdmonitor.service
Source7: mdadm.conf
Source8: mdadm_event.conf
# Fedora customization patches
Patch: mdadm-udev.patch
Patch: mdadm-2.5.2-static.patch
Patch97: mdadm-3.3-udev.patch
Patch98: mdadm-2.5.2-static.patch
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
License: GPLv2+
Group: System Environment/Base
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Obsoletes: mdctl,raidtools
Obsoletes: mdadm-sysvinit
Conflicts: dracut < 034-1
Requires(post): systemd-units chkconfig coreutils
BuildRequires: systemd-units binutils-devel
Requires(preun): systemd-units
Requires(postun): systemd-units coreutils
Requires: libreport-filesystem
BuildRequires: make
BuildRequires: systemd-rpm-macros
BuildRequires: binutils-devel
BuildRequires: gcc
BuildRequires: systemd-devel
BuildRequires: gnupg2
BuildRequires: mandoc
%if %{with abrt}
Requires: libreport-filesystem
%endif
Requires(post): coreutils
Requires(postun): coreutils
%description
%description
The mdadm program is used to create, manage, and monitor Linux MD (software
RAID) devices. As such, it provides similar functionality to the raidtools
package. However, mdadm is a single program, and it can perform
almost all functions without a configuration file, though a configuration
file can be used to help with some common tasks.
%prep
# because the tarball is what is signed, not the compressed tarball
# keyring should be one from https://git.kernel.org/pub/scm/docs/kernel/pgpkeys.git/plain/keys
# which will vary depending on who did the release
%{_bindir}/xz -dcT0 %{SOURCE0} | %{gpgverify} --keyring='%{SOURCE11}' --signature='%{SOURCE10}' --data=-
%autosetup -p1
%setup -q
# Fedora customization patches
%patch97 -p1 -b .udev
%patch98 -p1 -b .static
%build
# CXFLAGS is NOT a typo, it's baked into the makefile, not to be confused with CXXFLAGS
%make_build CXFLAGS="%{optflags} -std=gnu17 -Wno-error=unterminated-string-initialization" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon raid6check raid6check.man
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon
%install
%make_install MANDIR=%{_mandir} BINDIR=%{_sbindir} SYSTEMD_DIR=%{_unitdir} UDEVDIR=%{_prefix}/lib/udev/ install install-systemd
install -Dp -m 755 %{SOURCE1} %{buildroot}%{_sbindir}/raid-check
install -Dp -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/raid-check
mkdir -p -m 710 %{buildroot}/run/%{name}
mkdir -p -m 755 %{buildroot}%{_datadir}/%{name}
install -Dp -m 755 %{SOURCE8} %{buildroot}%{_datadir}/%{name}/mdcheck
rm -rf %{buildroot}
make DESTDIR=%{buildroot} MANDIR=%{_mandir} BINDIR=%{_sbindir} SYSTEMD_DIR=%{_unitdir} install install-systemd
install -Dp -m 755 %{SOURCE2} %{buildroot}%{_sbindir}/raid-check
install -Dp -m 644 %{SOURCE3} %{buildroot}%{_udevrulesdir}/65-md-incremental.rules
install -Dp -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/raid-check
install -Dp -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/cron.d/raid-check
mkdir -p -m 710 %{buildroot}/var/run/mdadm
# systemd
install -Dm644 %{SOURCE3} %{buildroot}%{_unitdir}
install -Dm644 %{SOURCE6} %{buildroot}%{_unitdir}
install -Dm644 %{SOURCE7} %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_unitdir}
install -m644 %{SOURCE6} %{buildroot}%{_unitdir}
# tmpfile
install -Dm 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf
mkdir -p %{buildroot}%{_tmpfilesdir}
install -m 0644 %{SOURCE7} %{buildroot}%{_tmpfilesdir}/%{name}.conf
mkdir -p %{buildroot}%{_localstatedir}/run/
install -d -m 0710 %{buildroot}/run/%{name}/
install -d -m 0710 %{buildroot}%{_localstatedir}/run/%{name}/
# abrt
%if %{with abrt}
install -Dm644 %{SOURCE5} %{buildroot}%{_sysconfdir}/libreport/events.d/%{name}_event.conf
%endif
mkdir -p %{buildroot}/etc/libreport/events.d
install -m644 %{SOURCE8} %{buildroot}/etc/libreport/events.d
# raid6check
install -Dm755 raid6check %{buildroot}/%{_sbindir}/raid6check
install -Dm644 raid6check.man %{buildroot}/%{_mandir}/man8/raid6check.man
%clean
rm -rf %{buildroot}
%post
%systemd_post mdmonitor.service raid-check.timer
# leftover from this service removal years ago (f18 era).
# we probably don't really need this anymore.
# https://bugzilla.redhat.com/show_bug.cgi?id=901651
%{_bindir}/systemctl disable mdmonitor-takeover.service >/dev/null 2>&1 || :
%systemd_post mdmonitor.service
/usr/bin/systemctl disable mdmonitor-takeover.service >/dev/null 2>&1 || :
%preun
%systemd_preun mdmonitor.service raid-check.timer
%systemd_preun mdmonitor.service
%postun
%systemd_postun_with_restart mdmonitor.service
%triggerun -- %{name} < 3.2.2-3
%{_bindir}/systemd-sysv-convert --save mdmonitor >/dev/null 2>&1 || :
/bin/systemctl --no-reload enable mdmonitor.service >/dev/null 2>&1 || :
/sbin/chkconfig --del mdmonitor >/dev/null 2>&1 || :
/bin/systemctl try-restart mdmonitor.service >/dev/null 2>&1 || :
%files
%license COPYING
%doc mdadm.conf-example misc/*
%{_udevrulesdir}/*-md-*
%{_sbindir}/%{name}
%{_sbindir}/mdmon
%{_sbindir}/raid-check
%{_sbindir}/raid6check
%{_unitdir}/md*
%{_unitdir}/raid-check.*
%defattr(-,root,root,-)
%doc TODO ChangeLog mdadm.conf-example COPYING misc/*
%{_udevrulesdir}/*
%{_sbindir}/*
%{_unitdir}/*
%{_mandir}/man*/md*
%{_mandir}/man8/raid6check*
%{_prefix}/lib/systemd/system-shutdown/mdadm.shutdown
%config(noreplace) %{_sysconfdir}/sysconfig/raid-check
%{_rundir}/%{name}/
/usr/lib/systemd/system-shutdown/*
%config(noreplace) %{_sysconfdir}/cron.d/*
%config(noreplace) %{_sysconfdir}/sysconfig/*
%dir %{_localstatedir}/run/%{name}/
%config(noreplace) %{_tmpfilesdir}/%{name}.conf
%if %{with abrt}
%{_sysconfdir}/libreport/events.d/mdadm_event.conf
%endif
%{_datadir}/%{name}/
/etc/libreport/events.d/*
%changelog
* Thu Aug 14 2025 Xiao Ni <xni@redhat.com> - 4.3-9
- Don't submit stop ioctl in assemble
- Resolves bz#2388480
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Sun Apr 06 2025 Adam Williamson <awilliam@redhat.com> - 4.3-7
- revert 'posix' name check to fix rhbz#2325906
* Thu Jan 23 2025 Jonathan Wright <jonathan@almalinux.org> - 4.3-6
- fix FTBFS on gcc15 rhbz#2340833
- fix permissions on /usr/share/mdadm to be world-readable rhbz#2322402
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Wed May 08 2024 Jonathan Wright <jonathan@almalinux.org> - 4.3-3
- use URLs for signature and pub key
- build and install raid6check and man page rhbz#2264741
* Wed May 08 2024 Jonathan Wright <jonathan@almalinux.org> - 4.3-2
- add source signature verification
- change source URL to https
* Wed May 08 2024 Jonathan Wright <jonathan@almalinux.org> - 4.3-1
- update to 4.3 rhbz#2267100
- modernize spec
* Wed May 08 2024 Jonathan Wright <jonathan@almalinux.org> - 4.2-9
- Fixes rhbz#2279743
- Use more macros in %files definitions
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Apr 12 2023 Xiao Ni <xni@redhat.com> - 4.2-5
- Update to latest upstream for rawhide(f39) and fix mdcheck service bug
- Resolves bz#2175540
* Mon Jan 30 2023 Xiao Ni <xni@redhat.com> - 4.2-4
- Update to latest upstream for f38
- Resolves bz#2163711
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Mar 21 2022 Xiao Ni <xni@redhat.com> - 4.2-1
- Update to mdadm-4.2
- Resolves bz#2066150
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.2-rc2.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Aug 09 2021 Xiao Ni <xni@redhat.com> - 4.2-rc2
- Update to mdadm-4.2-rc2
- Resolves bz#1988236
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 4.1-8
- Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed May 27 2020 Xiao Ni <xni@redhat.com> - 4.1-5
- Don't enable raid-check.service to avoid raid check after every boot
- Resolves bz1838409
* Sun Mar 08 2020 Peter Robinson <pbrobinson@fedoraproject.org> - 4.1-4
- Fix install location of udev rules (rhbz 1809117)
* Fri Feb 07 2020 Alejandro Domínguez Muñoz <adomu@net-c.com> - 4.1-3
- Replace raid-check cron job with systemd timer
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Jan 13 2020 Peter Robinson <pbrobinson@fedoraproject.org> 4.1-1
- Update to 4.1 GA
- Spec cleanups and updates
- Update mdadm.pid location (rhbz 1701114, rhbz 1557623, rhbz 1557623)
* Sun Dec 15 2019 Julian Sikorski <belegdol@fedoraproject.org> - 4.1-rc2.0.5.2
- Fix invalid substitution type error
- Resolves bz1740662, bz1749859
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-rc2.0.5.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Tue Jun 04 2019 Xiao Ni <xni@redhat.com> - 4.1-rc2.0.5
- Update tmpfiles directory to non-legacy location
- Resolves bz1704517
* Wed Apr 17 2019 Xiao Ni <xni@redhat.com> - 4.1-rc2.0.4
- Change tmpfiles directory to /run/mdadm
- Resovles bz1701821
* Sat Mar 16 2019 Björn Esser <besser82@fedoraproject.org> - 4.1-rc2.0.3
- Add patch to build without -Werror, fixes FTBFS (#1675363)
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-rc2.0.2.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Sep 13 2018 Adam Williamson <awilliam@redhat.com> - 4.1-rc2.0.2
- Fix multipath check in udev rule, broke array init in F29
- Resolves bz1628192
* Sun Aug 26 2018 Peter Robinson <pbrobinson@fedoraproject.org> 4.1-rc2.0.1
- Update to 4.1 rc2
* Fri Jul 20 2018 Xiao Ni <xni@redhat.com> - 4.1-rc1_1.2
- Add gcc into BuildRequires
- Resolves bz1604811
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-rc1_1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Jul 09 2018 Xiao Ni <xni@redhat.com> 4.1-rc1-1
- Update to latest upstream version 4.1-rc1
- Resolves bz1556591
* Wed Jul 4 2018 Peter Robinson <pbrobinson@fedoraproject.org> 4.0-7
- Cleanup spec, use %%licenece, drop old sys-v migration bits
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Apr 26 2017 Xiao Ni <xni@redhat.com> - 4.0-3
- Fix building errors against newer gcc (>=7.0)
- Resolves bz1444756
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Jan 12 2017 Xiao Ni <xni@redhat.com> - 4.0-1
- Upgrade to mdadm-4.0
- Resolves bz1411555
* Mon Aug 15 2016 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.4-3
- Fix build against newer glibc (Fedora 26+)
* Fri Aug 12 2016 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.4-2
- Fix i686 build error
- Fix problem where it was not possible to stop an IMSM array during reshape
* Mon May 30 2016 Xiao Ni <xni@redhat.com> - 3.3.4-3
- Fix Degraded Raid1 array becomes inactive after rebooting
- Fix problem with raid0 arrays not being detected by Anaconda due to it
setting MALLOC_PERTURB_
- Fix problem with reshaping IMSM arrays, where a new reshape could be
launched before the first reshape had fully completed, leading to
unpected results.
- Fix problem with mdadm large device names overflowing an internal buffer
- Fix problem about reshape stuck at beginning
- Resolves bz1303380
* Fri Aug 12 2016 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.4-1
- Upgrade to mdadm-3.4
- Resolves bz1303380
* Mon May 30 2016 Xiao Ni <xni@redhat.com> - 3.3.4-4
- Fix Degraded Raid1 array becomes inactive after rebooting
- Resolves bz1337004
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
- Resolves bz1337003
* Mon Oct 5 2015 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.3.4-2
- Fix race when assembling or stopping IMSM RAID arrays

166
mdcheck
View file

@ -1,166 +0,0 @@
#!/bin/bash
# Copyright (C) 2014-2017 Neil Brown <neilb@suse.de>
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# Author: Neil Brown
# Email: <neilb@suse.com>
# This script should be run periodically to automatically
# perform a 'check' on any md arrays.
#
# It supports a 'time budget' such that any incomplete 'check'
# will be checkpointed when that time has expired.
# A subsequent invocation can allow the 'check' to continue.
#
# Options are:
# --continue Don't start new checks, only continue old ones.
# --duration This is passed to "date --date=$duration" to find out
# when to finish
#
# To support '--continue', arrays are identified by UUID and the 'sync_completed'
# value is stored in /var/lib/mdcheck/$UUID
# convert a /dev/md name into /sys/.../md equivalent
sysname() {
set `ls -lLd $1`
maj=${5%,}
min=$6
readlink -f /sys/dev/block/$maj:$min
}
args=$(getopt -o hcd: -l help,continue,duration: -n mdcheck -- "$@")
rv=$?
if [ $rv -ne 0 ]; then exit $rv; fi
eval set -- $args
cont=
endtime=
while [ " $1" != " --" ]
do
case $1 in
--help )
echo >&2 'Usage: mdcheck [--continue] [--duration time-offset]'
echo >&2 ' time-offset must be understood by "date --date"'
exit 0
;;
--continue ) cont=yes ;;
--duration ) shift; dur=$1
endtime=$(date --date "$dur" "+%s")
;;
esac
shift
done
shift
# We need a temp file occasionally...
tmp=/var/lib/mdcheck/.md-check-$$
trap 'rm -f "$tmp"' 0 2 3 15
# firstly, clean out really old state files
mkdir -p /var/lib/mdcheck
find /var/lib/mdcheck -name "MD_UUID*" -type f -mtime +180 -exec rm {} \;
# Now look at each md device.
cnt=0
for dev in /dev/md?*
do
[ -e "$dev" ] || continue
sys=`sysname $dev`
if [ ! -f "$sys/md/sync_action" ]
then # cannot check this array
continue
fi
if [ "`cat $sys/md/sync_action`" != 'idle' ]
then # This array is busy
continue
fi
mdadm --detail --export "$dev" | grep '^MD_UUID=' > $tmp || continue
source $tmp
fl="/var/lib/mdcheck/MD_UUID_$MD_UUID"
if [ -z "$cont" ]
then
start=0
logger -p daemon.info mdcheck start checking $dev
elif [ -z "$MD_UUID" -o ! -f "$fl" ]
then
# Nothing to continue here
continue
else
start=`cat "$fl"`
logger -p daemon.info mdcheck continue checking $dev from $start
fi
cnt=$[cnt+1]
eval MD_${cnt}_fl=\$fl
eval MD_${cnt}_sys=\$sys
eval MD_${cnt}_dev=\$dev
echo $start > $fl
echo $start > $sys/md/sync_min
echo check > $sys/md/sync_action
done
if [ -z "$endtime" ]
then
exit 0
fi
while [ `date +%s` -lt $endtime ]
do
any=
for i in `eval echo {1..$cnt}`
do
eval fl=\$MD_${i}_fl
eval sys=\$MD_${i}_sys
eval dev=\$MD_${i}_dev
if [ -z "$fl" ]; then continue; fi
if [ "`cat $sys/md/sync_action`" != 'check' ]
then
logger -p daemon.info mdcheck finished checking $dev
eval MD_${i}_fl=
rm -f $fl
continue;
fi
read a rest < $sys/md/sync_completed
echo $a > $fl
any=yes
done
if [ -z "$any" ]; then exit 0; fi
sleep 120
done
# We've waited, and there are still checks running.
# Time to stop them.
for i in `eval echo {1..$cnt}`
do
eval fl=\$MD_${i}_fl
eval sys=\$MD_${i}_sys
eval dev=\$MD_${i}_dev
if [ -z "$fl" ]; then continue; fi
if [ "`cat $sys/md/sync_action`" != 'check' ]
then
eval MD_${i}_fl=
rm -f $fl
continue;
fi
echo idle > $sys/md/sync_action
cat $sys/md/sync_min > $fl
logger -p daemon.info pause checking $dev at `cat $fl`
done

118
mdmonitor.init Executable file
View file

@ -0,0 +1,118 @@
#!/bin/bash
#
# mdmonitor This starts, stops, and reloads the mdadm-based
# software RAID monitoring and management facility
#
# chkconfig: 2345 15 85
# description: software RAID monitoring and management
# config: /etc/mdadm.conf
#
# Copyright 2002 Red Hat, Inc.
#
### BEGIN INIT INFO
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the MD software RAID monitor
# Description: The mdmonitor service checks the status of all software
# RAID arrays on the system. In the event that any of the arrays
# transition into a degraded state, it notifies the system
# administrator. Other options are available, see the mdadm.conf
# and mdadm man pages for possible ways to configure this service.
### END INIT INFO
PIDPATH=/var/run/mdadm
PIDFILE=/var/run/mdadm/mdadm.pid
PATH=/sbin:/usr/sbin:$PATH
RETVAL=0
OPTIONS="--monitor --scan -f --pid-file=$PIDFILE"
prog=mdmonitor
# Source function library.
. /etc/rc.d/init.d/functions
usage ()
{
echo "Usage: service $prog {start|stop|status|restart|try-restart|force-reload}"
RETVAL=1
}
start ()
{
# (Re)start mdmon to take over monitoring of mdmon started from the initrd
for i in /dev/md/*.pid; do
if [ -r $i ]; then
origprog="$prog"; prog="mdmon"
action $"Starting $prog: " /sbin/mdmon --takeover --all
prog="$origprog"
break
fi
done
# Make sure configuration file exists and has information we can use
# MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor
[ -f /etc/mdadm.conf ] || return 6
grep '^\(MAILADDR\|PROGRAM\) .' /etc/mdadm.conf >/dev/null 2>&1 || return 6
# Create our directory if it isn't there yet
if [ ! -d $PIDPATH ]; then
mkdir -m 0700 $PIDPATH >&/dev/null
RC=$?
[ -x /sbin/restorecon ] && /sbin/restorecon $PIDPATH
if [ $RC -ne 0 ]; then
echo -n "Failed to create /var/run/mdadm"
failure
echo
return 1
fi
fi
if [ -f "$PIDFILE" ]; then
checkpid `cat $PIDFILE` && return 0
fi
echo -n $"Starting $prog: "
cd /
daemon --user=root mdadm ${OPTIONS}
ret=$?
[ $ret -eq "0" ] && touch /var/lock/subsys/$prog
echo
return $ret
}
stop ()
{
[ -f /var/lock/subsys/$prog ] || return 0
echo -n "Killing $prog: "
killproc mdadm
echo
rm -f $PIDFILE
rm -f /var/lock/subsys/$prog
}
restart ()
{
stop
start
}
condrestart ()
{
[ -e /var/lock/subsys/$prog ] && restart || return 0
}
case "$1" in
start|stop|restart|condrestart|try-restart|force-reload)
[ `id -u` != "0" ] && exit 4 ;;
esac
case "$1" in
start) start; RETVAL=$? ;;
stop) stop; RETVAL=$? ;;
status) status -p $PIDFILE $prog ; RETVAL=$? ;;
restart) restart; RETVAL=$? ;;
reload) RETVAL=3 ;;
condrestart|try-restart|force-reload) condrestart; RETVAL=$? ;;
*) usage ; RETVAL=2 ;;
esac
exit $RETVAL

View file

@ -4,9 +4,9 @@ ConditionPathExists=/etc/mdadm.conf
[Service]
Type=forking
PIDFile=/run/mdadm/mdadm.pid
PIDFile=/var/run/mdadm/mdadm.pid
EnvironmentFile=-/etc/sysconfig/mdmonitor
ExecStart=/sbin/mdadm --monitor --scan --syslog -f --pid-file=/run/mdadm/mdadm.pid
ExecStart=/sbin/mdadm --monitor --scan -f --pid-file=/var/run/mdadm/mdadm.pid
[Install]
WantedBy=multi-user.target

View file

@ -1,6 +0,0 @@
[Unit]
Description=RAID setup health check
[Service]
Type=oneshot
ExecStart=/usr/sbin/raid-check

View file

@ -1,10 +0,0 @@
[Unit]
Description=Weekly RAID setup health check
[Timer]
OnCalendar=Sun *-*-* 01:00:00
Persistent=true
AccuracySec=24h
[Install]
WantedBy=timers.target

View file

@ -1,2 +1 @@
SHA512 (mdadm-4.3.tar.xz) = e44977f2f80d2471cb313803a60c92dafe8282ac06bbbfd41ae90ca493c64a3da94db924538788d045fd7f0667333912dabedb0b070f9abf5c0540b32e0fa08f
SHA512 (mdadm-4.3.tar.sign) = c0ae042399974c360ffbf4f15928e59591eb88f97faac1d7892066fefb8f8c525fe0948a4fd6ddd3781d0b27d8891e1bd2e0cd9e6a2dbf17b9f8d8c4879dc6b1
7ca8b114710f98f53f20c5787b674a09 mdadm-3.3.4.tar.xz