Update to latest upstream
Resolves: rhbz#2052029, rhbz#1974184 Signed-off-by: Xiao Ni <xni@redhat.com>
This commit is contained in:
parent
5d4b4d1c30
commit
4bc609db47
47
0001-Unify-error-message.patch
Normal file
47
0001-Unify-error-message.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From f1cc8ab9ab6a92c3cd94ab7590b46285e214681e Mon Sep 17 00:00:00 2001
|
||||
From: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Date: Tue, 15 Mar 2022 09:30:30 +0100
|
||||
Subject: [PATCH 01/12] Unify error message.
|
||||
|
||||
Provide the same error message for the same error that can occur in Grow.c and super-intel.c.
|
||||
|
||||
Signed-off-by: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
Grow.c | 4 ++--
|
||||
super-intel.c | 4 ++--
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Grow.c b/Grow.c
|
||||
index 9c6fc95e..9a947204 100644
|
||||
--- a/Grow.c
|
||||
+++ b/Grow.c
|
||||
@@ -1001,8 +1001,8 @@ int remove_disks_for_takeover(struct supertype *st,
|
||||
rv = 1;
|
||||
sysfs_free(arrays);
|
||||
if (rv) {
|
||||
- pr_err("Error. Cannot perform operation on /dev/%s\n", st->devnm);
|
||||
- pr_err("For this operation it MUST be single array in container\n");
|
||||
+ pr_err("Error. Cannot perform operation on %s- for this operation "
|
||||
+ "it MUST be single array in container\n", st->devnm);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
diff --git a/super-intel.c b/super-intel.c
|
||||
index d5fad102..5ffa7636 100644
|
||||
--- a/super-intel.c
|
||||
+++ b/super-intel.c
|
||||
@@ -11683,8 +11683,8 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
|
||||
struct imsm_super *mpb = super->anchor;
|
||||
|
||||
if (mpb->num_raid_devs > 1) {
|
||||
- pr_err("Error. Cannot perform operation on %s- for this operation it MUST be single array in container\n",
|
||||
- geo->dev_name);
|
||||
+ pr_err("Error. Cannot perform operation on %s- for this operation "
|
||||
+ "it MUST be single array in container\n", geo->dev_name);
|
||||
change = -1;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
33
0002-mdadm-Fix-double-free.patch
Normal file
33
0002-mdadm-Fix-double-free.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 5ce5a15f0bf007e850e15259bba4f53736605fb2 Mon Sep 17 00:00:00 2001
|
||||
From: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Date: Fri, 25 Mar 2022 12:48:59 +0100
|
||||
Subject: [PATCH 02/12] mdadm: Fix double free
|
||||
|
||||
If there was a size mismatch after creation it would get fixed on grow
|
||||
in imsm_fix_size_mismatch(), but due to double free "double free or corruption (fasttop)"
|
||||
error occurs and grow cannot proceed.
|
||||
|
||||
Signed-off-by: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
super-intel.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/super-intel.c b/super-intel.c
|
||||
index 5ffa7636..6ff336ee 100644
|
||||
--- a/super-intel.c
|
||||
+++ b/super-intel.c
|
||||
@@ -11783,9 +11783,8 @@ static int imsm_fix_size_mismatch(struct supertype *st, int subarray_index)
|
||||
st->update_tail = &st->updates;
|
||||
} else {
|
||||
imsm_sync_metadata(st);
|
||||
+ free(update);
|
||||
}
|
||||
-
|
||||
- free(update);
|
||||
}
|
||||
ret_val = 0;
|
||||
exit:
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,83 @@
|
||||
From fea026b4849182fc8413014c81456e7215af28d9 Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Kusiak <mateusz.kusiak@intel.com>
|
||||
Date: Wed, 23 Mar 2022 15:05:19 +0100
|
||||
Subject: [PATCH 03/12] Grow_reshape: Add r0 grow size error message and update
|
||||
man
|
||||
|
||||
Grow size on r0 is not supported for imsm and native metadata.
|
||||
Add proper error message.
|
||||
Update man for proper use of --size.
|
||||
Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
Grow.c | 6 ++++++
|
||||
mdadm.8.in | 19 ++++++++++++-------
|
||||
2 files changed, 18 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/Grow.c b/Grow.c
|
||||
index 9a947204..aa72490b 100644
|
||||
--- a/Grow.c
|
||||
+++ b/Grow.c
|
||||
@@ -1998,6 +1998,12 @@ int Grow_reshape(char *devname, int fd,
|
||||
goto release;
|
||||
}
|
||||
|
||||
+ if (array.level == 0) {
|
||||
+ pr_err("Component size change is not supported for RAID0\n");
|
||||
+ rv = 1;
|
||||
+ goto release;
|
||||
+ }
|
||||
+
|
||||
if (reshape_super(st, s->size, UnSet, UnSet, 0, 0, UnSet, NULL,
|
||||
devname, APPLY_METADATA_CHANGES,
|
||||
c->verbose > 0)) {
|
||||
diff --git a/mdadm.8.in b/mdadm.8.in
|
||||
index be902dba..e2a42425 100644
|
||||
--- a/mdadm.8.in
|
||||
+++ b/mdadm.8.in
|
||||
@@ -459,7 +459,8 @@ number of spare devices.
|
||||
|
||||
.TP
|
||||
.BR \-z ", " \-\-size=
|
||||
-Amount (in Kilobytes) of space to use from each drive in RAID levels 1/4/5/6.
|
||||
+Amount (in Kilobytes) of space to use from each drive in RAID levels 1/4/5/6/10
|
||||
+and for RAID 0 on external metadata.
|
||||
This must be a multiple of the chunk size, and must leave about 128Kb
|
||||
of space at the end of the drive for the RAID superblock.
|
||||
If this is not specified
|
||||
@@ -478,10 +479,19 @@ To guard against this it can be useful to set the initial size
|
||||
slightly smaller than the smaller device with the aim that it will
|
||||
still be larger than any replacement.
|
||||
|
||||
+This option can be used with
|
||||
+.B \-\-create
|
||||
+for determining initial size of an array. For external metadata,
|
||||
+it can be used on a volume, but not on a container itself.
|
||||
+Setting initial size of
|
||||
+.B RAID 0
|
||||
+array is only valid for external metadata.
|
||||
+
|
||||
This value can be set with
|
||||
.B \-\-grow
|
||||
-for RAID level 1/4/5/6 though
|
||||
+for RAID level 1/4/5/6/10 though
|
||||
DDF arrays may not be able to support this.
|
||||
+RAID 0 array size cannot be changed.
|
||||
If the array was created with a size smaller than the currently
|
||||
active drives, the extra space can be accessed using
|
||||
.BR \-\-grow .
|
||||
@@ -501,11 +511,6 @@ problems the array can be made bigger again with no loss with another
|
||||
.B "\-\-grow \-\-size="
|
||||
command.
|
||||
|
||||
-This value cannot be used when creating a
|
||||
-.B CONTAINER
|
||||
-such as with DDF and IMSM metadata, though it perfectly valid when
|
||||
-creating an array inside a container.
|
||||
-
|
||||
.TP
|
||||
.BR \-Z ", " \-\-array\-size=
|
||||
This is only meaningful with
|
||||
--
|
||||
2.31.1
|
||||
|
67
0004-udev-adapt-rules-to-systemd-v247.patch
Normal file
67
0004-udev-adapt-rules-to-systemd-v247.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From cf9a109209aad285372b67306d54118af6fc522b Mon Sep 17 00:00:00 2001
|
||||
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
Date: Fri, 14 Jan 2022 16:44:33 +0100
|
||||
Subject: [PATCH 04/12] udev: adapt rules to systemd v247
|
||||
|
||||
New events have been added in kernel 4.14 ("bind" and "unbind").
|
||||
Systemd maintainer suggests to modify "add|change" branches.
|
||||
This patches implements their suggestions. There is no issue yet because
|
||||
new event types are not used in md.
|
||||
|
||||
Please see systemd announcement for details[1].
|
||||
|
||||
[1] https://lists.freedesktop.org/archives/systemd-devel/2020-November/045646.html
|
||||
|
||||
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
udev-md-raid-arrays.rules | 2 +-
|
||||
udev-md-raid-assembly.rules | 5 +++--
|
||||
udev-md-raid-safe-timeouts.rules | 2 +-
|
||||
3 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/udev-md-raid-arrays.rules b/udev-md-raid-arrays.rules
|
||||
index 13c9076e..2967ace1 100644
|
||||
--- a/udev-md-raid-arrays.rules
|
||||
+++ b/udev-md-raid-arrays.rules
|
||||
@@ -3,7 +3,7 @@
|
||||
SUBSYSTEM!="block", GOTO="md_end"
|
||||
|
||||
# handle md arrays
|
||||
-ACTION!="add|change", GOTO="md_end"
|
||||
+ACTION=="remove", GOTO="md_end"
|
||||
KERNEL!="md*", GOTO="md_end"
|
||||
|
||||
# partitions have no md/{array_state,metadata_version}, but should not
|
||||
diff --git a/udev-md-raid-assembly.rules b/udev-md-raid-assembly.rules
|
||||
index d668cddd..39b4344b 100644
|
||||
--- a/udev-md-raid-assembly.rules
|
||||
+++ b/udev-md-raid-assembly.rules
|
||||
@@ -30,8 +30,9 @@ LABEL="md_inc"
|
||||
|
||||
# remember you can limit what gets auto/incrementally assembled by
|
||||
# mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
|
||||
-ACTION=="add|change", IMPORT{program}="BINDIR/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}"
|
||||
-ACTION=="add|change", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer"
|
||||
+ACTION!="remove", IMPORT{program}="BINDIR/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}"
|
||||
+ACTION!="remove", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer"
|
||||
+
|
||||
ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="BINDIR/mdadm -If $name --path $env{ID_PATH}"
|
||||
ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="BINDIR/mdadm -If $name"
|
||||
|
||||
diff --git a/udev-md-raid-safe-timeouts.rules b/udev-md-raid-safe-timeouts.rules
|
||||
index 12bdcaa8..2e185cee 100644
|
||||
--- a/udev-md-raid-safe-timeouts.rules
|
||||
+++ b/udev-md-raid-safe-timeouts.rules
|
||||
@@ -50,7 +50,7 @@ ENV{DEVTYPE}!="partition", GOTO="md_timeouts_end"
|
||||
|
||||
IMPORT{program}="/sbin/mdadm --examine --export $devnode"
|
||||
|
||||
-ACTION=="add|change", \
|
||||
+ACTION!="remove", \
|
||||
ENV{ID_FS_TYPE}=="linux_raid_member", \
|
||||
ENV{MD_LEVEL}=="raid[1-9]*", \
|
||||
TEST=="/sys/block/$parent/device/timeout", \
|
||||
--
|
||||
2.31.1
|
||||
|
252
0005-Replace-error-prone-signal-with-sigaction.patch
Normal file
252
0005-Replace-error-prone-signal-with-sigaction.patch
Normal file
@ -0,0 +1,252 @@
|
||||
From 83a379cfbd283b387919fe05d44eb4c49e155ad6 Mon Sep 17 00:00:00 2001
|
||||
From: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Date: Mon, 21 Feb 2022 13:05:20 +0100
|
||||
Subject: [PATCH 05/12] Replace error prone signal() with sigaction()
|
||||
|
||||
Up to this date signal() was used which implementation could vary [1].
|
||||
Sigaction() call is preferred. This commit introduces replacement
|
||||
from signal() to sigaction() by the use of signal_s() wrapper.
|
||||
Also remove redundant signal.h header includes.
|
||||
|
||||
[1] https://man7.org/linux/man-pages/man2/signal.2.html
|
||||
|
||||
Signed-off-by: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
Grow.c | 4 ++--
|
||||
Monitor.c | 5 +++--
|
||||
managemon.c | 1 -
|
||||
mdadm.h | 22 ++++++++++++++++++++++
|
||||
mdmon.c | 1 -
|
||||
monitor.c | 1 -
|
||||
probe_roms.c | 6 +++---
|
||||
raid6check.c | 25 +++++++++++++++----------
|
||||
util.c | 1 -
|
||||
9 files changed, 45 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/Grow.c b/Grow.c
|
||||
index aa72490b..18c5719b 100644
|
||||
--- a/Grow.c
|
||||
+++ b/Grow.c
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <sys/mman.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
-#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#if ! defined(__BIG_ENDIAN) && ! defined(__LITTLE_ENDIAN)
|
||||
@@ -3566,7 +3565,8 @@ started:
|
||||
fd = -1;
|
||||
mlockall(MCL_FUTURE);
|
||||
|
||||
- signal(SIGTERM, catch_term);
|
||||
+ if (signal_s(SIGTERM, catch_term) == SIG_ERR)
|
||||
+ goto release;
|
||||
|
||||
if (st->ss->external) {
|
||||
/* metadata handler takes it from here */
|
||||
diff --git a/Monitor.c b/Monitor.c
|
||||
index 30c031a2..c0ab5412 100644
|
||||
--- a/Monitor.c
|
||||
+++ b/Monitor.c
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "md_p.h"
|
||||
#include "md_u.h"
|
||||
#include <sys/wait.h>
|
||||
-#include <signal.h>
|
||||
#include <limits.h>
|
||||
#include <syslog.h>
|
||||
#ifndef NO_LIBUDEV
|
||||
@@ -435,8 +434,10 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
|
||||
if (mp) {
|
||||
FILE *mdstat;
|
||||
char hname[256];
|
||||
+
|
||||
gethostname(hname, sizeof(hname));
|
||||
- signal(SIGPIPE, SIG_IGN);
|
||||
+ signal_s(SIGPIPE, SIG_IGN);
|
||||
+
|
||||
if (info->mailfrom)
|
||||
fprintf(mp, "From: %s\n", info->mailfrom);
|
||||
else
|
||||
diff --git a/managemon.c b/managemon.c
|
||||
index bb7334cf..0e9bdf00 100644
|
||||
--- a/managemon.c
|
||||
+++ b/managemon.c
|
||||
@@ -106,7 +106,6 @@
|
||||
#include "mdmon.h"
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/socket.h>
|
||||
-#include <signal.h>
|
||||
|
||||
static void close_aa(struct active_array *aa)
|
||||
{
|
||||
diff --git a/mdadm.h b/mdadm.h
|
||||
index c7268a71..26e7e5cd 100644
|
||||
--- a/mdadm.h
|
||||
+++ b/mdadm.h
|
||||
@@ -46,6 +46,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <stdbool.h>
|
||||
+#include <signal.h>
|
||||
/* Newer glibc requires sys/sysmacros.h directly for makedev() */
|
||||
#include <sys/sysmacros.h>
|
||||
#ifdef __dietlibc__
|
||||
@@ -1729,6 +1730,27 @@ static inline char *to_subarray(struct mdstat_ent *ent, char *container)
|
||||
return &ent->metadata_version[10+strlen(container)+1];
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * signal_s() - Wrapper for sigaction() with signal()-like interface.
|
||||
+ * @sig: The signal to set the signal handler to.
|
||||
+ * @handler: The signal handler.
|
||||
+ *
|
||||
+ * Return: previous handler or SIG_ERR on failure.
|
||||
+ */
|
||||
+static inline sighandler_t signal_s(int sig, sighandler_t handler)
|
||||
+{
|
||||
+ struct sigaction new_act;
|
||||
+ struct sigaction old_act;
|
||||
+
|
||||
+ new_act.sa_handler = handler;
|
||||
+ new_act.sa_flags = 0;
|
||||
+
|
||||
+ if (sigaction(sig, &new_act, &old_act) == 0)
|
||||
+ return old_act.sa_handler;
|
||||
+
|
||||
+ return SIG_ERR;
|
||||
+}
|
||||
+
|
||||
#ifdef DEBUG
|
||||
#define dprintf(fmt, arg...) \
|
||||
fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##arg)
|
||||
diff --git a/mdmon.c b/mdmon.c
|
||||
index c71e62c6..5570574b 100644
|
||||
--- a/mdmon.c
|
||||
+++ b/mdmon.c
|
||||
@@ -56,7 +56,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
-#include <signal.h>
|
||||
#include <dirent.h>
|
||||
#ifdef USE_PTHREADS
|
||||
#include <pthread.h>
|
||||
diff --git a/monitor.c b/monitor.c
|
||||
index e0d3be67..b877e595 100644
|
||||
--- a/monitor.c
|
||||
+++ b/monitor.c
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "mdmon.h"
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/select.h>
|
||||
-#include <signal.h>
|
||||
|
||||
static char *array_states[] = {
|
||||
"clear", "inactive", "suspended", "readonly", "read-auto",
|
||||
diff --git a/probe_roms.c b/probe_roms.c
|
||||
index 7ea04c7a..94c80c2c 100644
|
||||
--- a/probe_roms.c
|
||||
+++ b/probe_roms.c
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "probe_roms.h"
|
||||
#include "mdadm.h"
|
||||
#include <unistd.h>
|
||||
-#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -69,7 +68,8 @@ static int probe_address16(const __u16 *ptr, __u16 *val)
|
||||
|
||||
void probe_roms_exit(void)
|
||||
{
|
||||
- signal(SIGBUS, SIG_DFL);
|
||||
+ signal_s(SIGBUS, SIG_DFL);
|
||||
+
|
||||
if (rom_fd >= 0) {
|
||||
close(rom_fd);
|
||||
rom_fd = -1;
|
||||
@@ -98,7 +98,7 @@ int probe_roms_init(unsigned long align)
|
||||
if (roms_init())
|
||||
return -1;
|
||||
|
||||
- if (signal(SIGBUS, sigbus) == SIG_ERR)
|
||||
+ if (signal_s(SIGBUS, sigbus) == SIG_ERR)
|
||||
rc = -1;
|
||||
if (rc == 0) {
|
||||
fd = open("/dev/mem", O_RDONLY);
|
||||
diff --git a/raid6check.c b/raid6check.c
|
||||
index a8e6005b..99477761 100644
|
||||
--- a/raid6check.c
|
||||
+++ b/raid6check.c
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "mdadm.h"
|
||||
#include <stdint.h>
|
||||
-#include <signal.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define CHECK_PAGE_BITS (12)
|
||||
@@ -130,30 +129,36 @@ void raid6_stats(int *disk, int *results, int raid_disks, int chunk_size)
|
||||
}
|
||||
|
||||
int lock_stripe(struct mdinfo *info, unsigned long long start,
|
||||
- int chunk_size, int data_disks, sighandler_t *sig) {
|
||||
+ int chunk_size, int data_disks, sighandler_t *sig)
|
||||
+{
|
||||
int rv;
|
||||
+
|
||||
+ sig[0] = signal_s(SIGTERM, SIG_IGN);
|
||||
+ sig[1] = signal_s(SIGINT, SIG_IGN);
|
||||
+ sig[2] = signal_s(SIGQUIT, SIG_IGN);
|
||||
+
|
||||
+ if (sig[0] == SIG_ERR || sig[1] == SIG_ERR || sig[2] == SIG_ERR)
|
||||
+ return 1;
|
||||
+
|
||||
if(mlockall(MCL_CURRENT | MCL_FUTURE) != 0) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
- sig[0] = signal(SIGTERM, SIG_IGN);
|
||||
- sig[1] = signal(SIGINT, SIG_IGN);
|
||||
- sig[2] = signal(SIGQUIT, SIG_IGN);
|
||||
-
|
||||
rv = sysfs_set_num(info, NULL, "suspend_lo", start * chunk_size * data_disks);
|
||||
rv |= sysfs_set_num(info, NULL, "suspend_hi", (start + 1) * chunk_size * data_disks);
|
||||
return rv * 256;
|
||||
}
|
||||
|
||||
-int unlock_all_stripes(struct mdinfo *info, sighandler_t *sig) {
|
||||
+int unlock_all_stripes(struct mdinfo *info, sighandler_t *sig)
|
||||
+{
|
||||
int rv;
|
||||
rv = sysfs_set_num(info, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL);
|
||||
rv |= sysfs_set_num(info, NULL, "suspend_hi", 0);
|
||||
rv |= sysfs_set_num(info, NULL, "suspend_lo", 0);
|
||||
|
||||
- signal(SIGQUIT, sig[2]);
|
||||
- signal(SIGINT, sig[1]);
|
||||
- signal(SIGTERM, sig[0]);
|
||||
+ signal_s(SIGQUIT, sig[2]);
|
||||
+ signal_s(SIGINT, sig[1]);
|
||||
+ signal_s(SIGTERM, sig[0]);
|
||||
|
||||
if(munlockall() != 0)
|
||||
return 3;
|
||||
diff --git a/util.c b/util.c
|
||||
index 3d05d074..cc94f96e 100644
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <poll.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
-#include <signal.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
1533
0006-mdadm-Respect-config-file-location-in-man.patch
Normal file
1533
0006-mdadm-Respect-config-file-location-in-man.patch
Normal file
File diff suppressed because it is too large
Load Diff
48
0007-mdadm-Update-ReadMe.patch
Normal file
48
0007-mdadm-Update-ReadMe.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From c23400377bb3d8e98e810cd92dba478dac1dff82 Mon Sep 17 00:00:00 2001
|
||||
From: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Date: Fri, 18 Mar 2022 09:26:05 +0100
|
||||
Subject: [PATCH 07/12] mdadm: Update ReadMe
|
||||
|
||||
Instead of hardcoded config file path give reference to config manual.
|
||||
|
||||
Add missing monitordelay and homecluster parameters.
|
||||
|
||||
Signed-off-by: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Acked-by: Coly Li <colyli@suse.de>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
ReadMe.c | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/ReadMe.c b/ReadMe.c
|
||||
index 81399765..8f873c48 100644
|
||||
--- a/ReadMe.c
|
||||
+++ b/ReadMe.c
|
||||
@@ -613,7 +613,6 @@ char Help_incr[] =
|
||||
;
|
||||
|
||||
char Help_config[] =
|
||||
-"The /etc/mdadm.conf config file:\n\n"
|
||||
" The config file contains, apart from blank lines and comment lines that\n"
|
||||
" start with a hash(#), array lines, device lines, and various\n"
|
||||
" configuration lines.\n"
|
||||
@@ -636,10 +635,12 @@ char Help_config[] =
|
||||
" than a device must match all of them to be considered.\n"
|
||||
"\n"
|
||||
" Other configuration lines include:\n"
|
||||
-" mailaddr, mailfrom, program used for --monitor mode\n"
|
||||
-" create, auto used when creating device names in /dev\n"
|
||||
-" homehost, policy, part-policy used to guide policy in various\n"
|
||||
-" situations\n"
|
||||
+" mailaddr, mailfrom, program, monitordelay used for --monitor mode\n"
|
||||
+" create, auto used when creating device names in /dev\n"
|
||||
+" homehost, homecluster, policy, part-policy used to guide policy in various\n"
|
||||
+" situations\n"
|
||||
+"\n"
|
||||
+"For more details see mdadm.conf(5).\n"
|
||||
"\n"
|
||||
;
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
203
0008-mdadm-Update-config-man-regarding-default-files-and-.patch
Normal file
203
0008-mdadm-Update-config-man-regarding-default-files-and-.patch
Normal file
@ -0,0 +1,203 @@
|
||||
From 24e075c659d0a8718aabefe5af4c97195a188af7 Mon Sep 17 00:00:00 2001
|
||||
From: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Date: Fri, 18 Mar 2022 09:26:06 +0100
|
||||
Subject: [PATCH 08/12] mdadm: Update config man regarding default files and
|
||||
multi-keyword behavior
|
||||
|
||||
Simplify default and alternative config file and directory location references
|
||||
from mdadm(8) as references to mdadm.conf(5). Add FILE section in config man
|
||||
and explain order and conditions in which default and alternative config files
|
||||
and directories are used.
|
||||
|
||||
Update config man behavior regarding parsing order when multiple keywords/config
|
||||
files are involved.
|
||||
|
||||
Signed-off-by: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Acked-by: Coly Li <colyli@suse.de>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
mdadm.8.in | 30 +++++++++--------------
|
||||
mdadm.conf.5.in | 65 ++++++++++++++++++++++++++++++++++++++++++++-----
|
||||
2 files changed, 71 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/mdadm.8.in b/mdadm.8.in
|
||||
index 8b21ffd4..0be02e4a 100644
|
||||
--- a/mdadm.8.in
|
||||
+++ b/mdadm.8.in
|
||||
@@ -266,14 +266,11 @@ the exact meaning of this option in different contexts.
|
||||
|
||||
.TP
|
||||
.BR \-c ", " \-\-config=
|
||||
-Specify the config file or directory. Default is to use
|
||||
-.B {CONFFILE}
|
||||
-and
|
||||
-.BR {CONFFILE}.d ,
|
||||
-or if those are missing then
|
||||
-.B {CONFFILE2}
|
||||
-and
|
||||
-.BR {CONFFILE2}.d .
|
||||
+Specify the config file or directory. If not specified, default config file
|
||||
+and default conf.d directory will be used. See
|
||||
+.BR mdadm.conf (5)
|
||||
+for more details.
|
||||
+
|
||||
If the config file given is
|
||||
.B "partitions"
|
||||
then nothing will be read, but
|
||||
@@ -2013,11 +2010,9 @@ The config file is only used if explicitly named with
|
||||
.B \-\-config
|
||||
or requested with (a possibly implicit)
|
||||
.BR \-\-scan .
|
||||
-In the later case,
|
||||
-.B {CONFFILE}
|
||||
-or
|
||||
-.B {CONFFILE2}
|
||||
-is used.
|
||||
+In the later case, default config file is used. See
|
||||
+.BR mdadm.conf (5)
|
||||
+for more details.
|
||||
|
||||
If
|
||||
.B \-\-scan
|
||||
@@ -3346,16 +3341,15 @@ on Monitor mode.
|
||||
|
||||
.SS {CONFFILE} (or {CONFFILE2})
|
||||
|
||||
-The config file lists which devices may be scanned to see if
|
||||
-they contain MD super block, and gives identifying information
|
||||
-(e.g. UUID) about known MD arrays. See
|
||||
+Default config file. See
|
||||
.BR mdadm.conf (5)
|
||||
for more details.
|
||||
|
||||
.SS {CONFFILE}.d (or {CONFFILE2}.d)
|
||||
|
||||
-A directory containing configuration files which are read in lexical
|
||||
-order.
|
||||
+Default directory containing configuration files. See
|
||||
+.BR mdadm.conf (5)
|
||||
+for more details.
|
||||
|
||||
.SS {MAP_PATH}
|
||||
When
|
||||
diff --git a/mdadm.conf.5.in b/mdadm.conf.5.in
|
||||
index 83edd008..dd331a6a 100644
|
||||
--- a/mdadm.conf.5.in
|
||||
+++ b/mdadm.conf.5.in
|
||||
@@ -88,7 +88,8 @@ but only the major and minor device numbers. It scans
|
||||
.I /dev
|
||||
to find the name that matches the numbers.
|
||||
|
||||
-If no DEVICE line is present, then "DEVICE partitions containers" is assumed.
|
||||
+If no DEVICE line is present in any config file,
|
||||
+then "DEVICE partitions containers" is assumed.
|
||||
|
||||
For example:
|
||||
.IP
|
||||
@@ -272,6 +273,10 @@ catenated with spaces to form the address.
|
||||
Note that this value cannot be set via the
|
||||
.I mdadm
|
||||
commandline. It is only settable via the config file.
|
||||
+There should only be one
|
||||
+.B MAILADDR
|
||||
+line and it should have only one address. Any subsequent addresses
|
||||
+are silently ignored.
|
||||
|
||||
.TP
|
||||
.B PROGRAM
|
||||
@@ -286,7 +291,8 @@ device.
|
||||
|
||||
There should only be one
|
||||
.B program
|
||||
-line and it should be give only one program.
|
||||
+line and it should be given only one program. Any subsequent programs
|
||||
+are silently ignored.
|
||||
|
||||
|
||||
.TP
|
||||
@@ -295,7 +301,14 @@ The
|
||||
.B create
|
||||
line gives default values to be used when creating arrays, new members
|
||||
of arrays, and device entries for arrays.
|
||||
-These include:
|
||||
+
|
||||
+There should only be one
|
||||
+.B create
|
||||
+line. Any subsequent lines will override the previous settings.
|
||||
+
|
||||
+Keywords used in the
|
||||
+.I CREATE
|
||||
+line and supported values are:
|
||||
|
||||
.RS 4
|
||||
.TP
|
||||
@@ -475,8 +488,8 @@ The known metadata types are
|
||||
|
||||
.B AUTO
|
||||
should be given at most once. Subsequent lines are silently ignored.
|
||||
-Thus an earlier config file in a config directory will over-ride
|
||||
-the setting in a later config file.
|
||||
+Thus a later config file in a config directory will not overwrite
|
||||
+the setting in an earlier config file.
|
||||
|
||||
.TP
|
||||
.B POLICY
|
||||
@@ -594,6 +607,7 @@ The
|
||||
line lists custom values of MD device's sysfs attributes which will be
|
||||
stored in sysfs after the array is assembled. Multiple lines are allowed and each
|
||||
line has to contain the uuid or the name of the device to which it relates.
|
||||
+Lines are applied in reverse order.
|
||||
.RS 4
|
||||
.TP
|
||||
.B uuid=
|
||||
@@ -621,7 +635,46 @@ is running in
|
||||
.B \-\-monitor
|
||||
mode.
|
||||
.B \-d/\-\-delay
|
||||
-command line argument takes precedence over the config file
|
||||
+command line argument takes precedence over the config file.
|
||||
+
|
||||
+If multiple
|
||||
+.B MINITORDELAY
|
||||
+lines are provided, only first non-zero value is considered.
|
||||
+
|
||||
+.SH FILES
|
||||
+
|
||||
+.SS {CONFFILE}
|
||||
+
|
||||
+The default config file location, used when
|
||||
+.I mdadm
|
||||
+is running without --config option.
|
||||
+
|
||||
+.SS {CONFFILE}.d
|
||||
+
|
||||
+The default directory with config files. Used when
|
||||
+.I mdadm
|
||||
+is running without --config option, after successful reading of the
|
||||
+.B {CONFFILE}
|
||||
+default config file. Files in that directory
|
||||
+are read in lexical order.
|
||||
+
|
||||
+
|
||||
+.SS {CONFFILE2}
|
||||
+
|
||||
+Alternative config file that is read, when
|
||||
+.I mdadm
|
||||
+is running without --config option and the
|
||||
+.B {CONFFILE}
|
||||
+default config file was not opened successfully.
|
||||
+
|
||||
+.SS {CONFFILE2}.d
|
||||
+
|
||||
+The alternative directory with config files. Used when
|
||||
+.I mdadm
|
||||
+is runninng without --config option, after reading the
|
||||
+.B {CONFFILE2}
|
||||
+alternative config file whether it was successful or not. Files in
|
||||
+that directory are read in lexical order.
|
||||
|
||||
.SH EXAMPLE
|
||||
DEVICE /dev/sd[bcdjkl]1
|
||||
--
|
||||
2.31.1
|
||||
|
45
0009-mdadm-Update-config-manual.patch
Normal file
45
0009-mdadm-Update-config-manual.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From c33bbda5b0e127bb161fd4ad44bcfaa2a5daf153 Mon Sep 17 00:00:00 2001
|
||||
From: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Date: Fri, 18 Mar 2022 09:26:07 +0100
|
||||
Subject: [PATCH 09/12] mdadm: Update config manual
|
||||
|
||||
Add missing HOMECLUSTER keyword description.
|
||||
|
||||
Signed-off-by: Lukasz Florczak <lukasz.florczak@linux.intel.com>
|
||||
Acked-by: Coly Li <colyli@suse.de>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
mdadm.conf.5.in | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
|
||||
diff --git a/mdadm.conf.5.in b/mdadm.conf.5.in
|
||||
index dd331a6a..cd4e6a9d 100644
|
||||
--- a/mdadm.conf.5.in
|
||||
+++ b/mdadm.conf.5.in
|
||||
@@ -439,6 +439,23 @@ from any possible local name. e.g.
|
||||
.B /dev/md/1_1
|
||||
or
|
||||
.BR /dev/md/home_0 .
|
||||
+
|
||||
+.TP
|
||||
+.B HOMECLUSTER
|
||||
+The
|
||||
+.B homcluster
|
||||
+line gives a default value for the
|
||||
+.B \-\-homecluster=
|
||||
+option to mdadm. It specifies the cluster name for the md device.
|
||||
+The md device can be assembled only on the cluster which matches
|
||||
+the name specified. If
|
||||
+.B homcluster
|
||||
+is not provided, mdadm tries to detect the cluster name automatically.
|
||||
+
|
||||
+There should only be one
|
||||
+.B homecluster
|
||||
+line. Any subsequent lines will be silently ignored.
|
||||
+
|
||||
.TP
|
||||
.B AUTO
|
||||
A list of names of metadata format can be given, each preceded by a
|
||||
--
|
||||
2.31.1
|
||||
|
153
0010-Create-Build-use-default_layout.patch
Normal file
153
0010-Create-Build-use-default_layout.patch
Normal file
@ -0,0 +1,153 @@
|
||||
From 913f07d1db4a0078acc26d6ccabe1c315cf9273c Mon Sep 17 00:00:00 2001
|
||||
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
Date: Thu, 20 Jan 2022 13:18:32 +0100
|
||||
Subject: [PATCH 10/12] Create, Build: use default_layout()
|
||||
|
||||
This code is duplicated for Build mode so make default_layout() extern
|
||||
and use it. Simplify the function structure.
|
||||
|
||||
It introduced change for Build mode, now for raid0 RAID0_ORIG_LAYOUT
|
||||
will be returned same as for Create.
|
||||
|
||||
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
Build.c | 23 +------------------
|
||||
Create.c | 67 ++++++++++++++++++++++++++++++++++----------------------
|
||||
mdadm.h | 1 +
|
||||
3 files changed, 43 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/Build.c b/Build.c
|
||||
index 962c2e37..8d6f6f58 100644
|
||||
--- a/Build.c
|
||||
+++ b/Build.c
|
||||
@@ -71,28 +71,7 @@ int Build(char *mddev, struct mddev_dev *devlist,
|
||||
}
|
||||
|
||||
if (s->layout == UnSet)
|
||||
- switch(s->level) {
|
||||
- default: /* no layout */
|
||||
- s->layout = 0;
|
||||
- break;
|
||||
- case 10:
|
||||
- s->layout = 0x102; /* near=2, far=1 */
|
||||
- if (c->verbose > 0)
|
||||
- pr_err("layout defaults to n1\n");
|
||||
- break;
|
||||
- case 5:
|
||||
- case 6:
|
||||
- s->layout = map_name(r5layout, "default");
|
||||
- if (c->verbose > 0)
|
||||
- pr_err("layout defaults to %s\n", map_num(r5layout, s->layout));
|
||||
- break;
|
||||
- case LEVEL_FAULTY:
|
||||
- s->layout = map_name(faultylayout, "default");
|
||||
-
|
||||
- if (c->verbose > 0)
|
||||
- pr_err("layout defaults to %s\n", map_num(faultylayout, s->layout));
|
||||
- break;
|
||||
- }
|
||||
+ s->layout = default_layout(NULL, s->level, c->verbose);
|
||||
|
||||
/* We need to create the device. It can have no name. */
|
||||
map_lock(&map);
|
||||
diff --git a/Create.c b/Create.c
|
||||
index 0ff1922d..9ea19de0 100644
|
||||
--- a/Create.c
|
||||
+++ b/Create.c
|
||||
@@ -39,39 +39,54 @@ static int round_size_and_verify(unsigned long long *size, int chunk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int default_layout(struct supertype *st, int level, int verbose)
|
||||
+/**
|
||||
+ * default_layout() - Get default layout for level.
|
||||
+ * @st: metadata requested, could be NULL.
|
||||
+ * @level: raid level requested.
|
||||
+ * @verbose: verbose level.
|
||||
+ *
|
||||
+ * Try to ask metadata handler first, otherwise use global defaults.
|
||||
+ *
|
||||
+ * Return: Layout or &UnSet, return value meaning depends of level used.
|
||||
+ */
|
||||
+int default_layout(struct supertype *st, int level, int verbose)
|
||||
{
|
||||
int layout = UnSet;
|
||||
+ mapping_t *layout_map = NULL;
|
||||
+ char *layout_name = NULL;
|
||||
|
||||
if (st && st->ss->default_geometry)
|
||||
st->ss->default_geometry(st, &level, &layout, NULL);
|
||||
|
||||
- if (layout == UnSet)
|
||||
- switch(level) {
|
||||
- default: /* no layout */
|
||||
- layout = 0;
|
||||
- break;
|
||||
- case 0:
|
||||
- layout = RAID0_ORIG_LAYOUT;
|
||||
- break;
|
||||
- case 10:
|
||||
- layout = 0x102; /* near=2, far=1 */
|
||||
- if (verbose > 0)
|
||||
- pr_err("layout defaults to n2\n");
|
||||
- break;
|
||||
- case 5:
|
||||
- case 6:
|
||||
- layout = map_name(r5layout, "default");
|
||||
- if (verbose > 0)
|
||||
- pr_err("layout defaults to %s\n", map_num(r5layout, layout));
|
||||
- break;
|
||||
- case LEVEL_FAULTY:
|
||||
- layout = map_name(faultylayout, "default");
|
||||
+ if (layout != UnSet)
|
||||
+ return layout;
|
||||
|
||||
- if (verbose > 0)
|
||||
- pr_err("layout defaults to %s\n", map_num(faultylayout, layout));
|
||||
- break;
|
||||
- }
|
||||
+ switch (level) {
|
||||
+ default: /* no layout */
|
||||
+ layout = 0;
|
||||
+ break;
|
||||
+ case 0:
|
||||
+ layout = RAID0_ORIG_LAYOUT;
|
||||
+ break;
|
||||
+ case 10:
|
||||
+ layout = 0x102; /* near=2, far=1 */
|
||||
+ layout_name = "n2";
|
||||
+ break;
|
||||
+ case 5:
|
||||
+ case 6:
|
||||
+ layout_map = r5layout;
|
||||
+ break;
|
||||
+ case LEVEL_FAULTY:
|
||||
+ layout_map = faultylayout;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (layout_map) {
|
||||
+ layout = map_name(layout_map, "default");
|
||||
+ layout_name = map_num(layout_map, layout);
|
||||
+ }
|
||||
+ if (layout_name && verbose > 0)
|
||||
+ pr_err("layout defaults to %s\n", layout_name);
|
||||
|
||||
return layout;
|
||||
}
|
||||
diff --git a/mdadm.h b/mdadm.h
|
||||
index 26e7e5cd..cd72e711 100644
|
||||
--- a/mdadm.h
|
||||
+++ b/mdadm.h
|
||||
@@ -1512,6 +1512,7 @@ extern int get_linux_version(void);
|
||||
extern int mdadm_version(char *version);
|
||||
extern unsigned long long parse_size(char *size);
|
||||
extern int parse_uuid(char *str, int uuid[4]);
|
||||
+int default_layout(struct supertype *st, int level, int verbose);
|
||||
extern int is_near_layout_10(int layout);
|
||||
extern int parse_layout_10(char *layout);
|
||||
extern int parse_layout_faulty(char *layout);
|
||||
--
|
||||
2.31.1
|
||||
|
382
0011-mdadm-add-map_num_s.patch
Normal file
382
0011-mdadm-add-map_num_s.patch
Normal file
@ -0,0 +1,382 @@
|
||||
From 5f21d67472ad08c1e96b4385254adba79aa1c467 Mon Sep 17 00:00:00 2001
|
||||
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
Date: Thu, 20 Jan 2022 13:18:33 +0100
|
||||
Subject: [PATCH 11/12] mdadm: add map_num_s()
|
||||
|
||||
map_num() returns NULL if key is not defined. This patch adds
|
||||
alternative, non NULL version for cases where NULL is not expected.
|
||||
|
||||
There are many printf() calls where map_num() is called on variable
|
||||
without NULL verification. It works, even if NULL is passed because
|
||||
gcc is able to ignore NULL argument quietly but the behavior is
|
||||
undefined. For safety reasons such usages will use map_num_s() now.
|
||||
It is a potential point of regression.
|
||||
|
||||
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
Assemble.c | 6 ++----
|
||||
Create.c | 2 +-
|
||||
Detail.c | 4 ++--
|
||||
Grow.c | 16 ++++++++--------
|
||||
Query.c | 4 ++--
|
||||
maps.c | 24 ++++++++++++++++++++++++
|
||||
mdadm.c | 20 ++++++++++----------
|
||||
mdadm.h | 2 +-
|
||||
super-ddf.c | 6 +++---
|
||||
super-intel.c | 2 +-
|
||||
super0.c | 2 +-
|
||||
super1.c | 2 +-
|
||||
sysfs.c | 9 +++++----
|
||||
13 files changed, 61 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/Assemble.c b/Assemble.c
|
||||
index 704b8293..9eac9ce0 100644
|
||||
--- a/Assemble.c
|
||||
+++ b/Assemble.c
|
||||
@@ -63,7 +63,7 @@ static void set_array_assembly_status(struct context *c,
|
||||
struct assembly_array_info *arr)
|
||||
{
|
||||
int raid_disks = arr->preexist_cnt + arr->new_cnt;
|
||||
- char *status_msg = map_num(assemble_statuses, status);
|
||||
+ char *status_msg = map_num_s(assemble_statuses, status);
|
||||
|
||||
if (c->export && result)
|
||||
*result |= status;
|
||||
@@ -77,9 +77,7 @@ static void set_array_assembly_status(struct context *c,
|
||||
fprintf(stderr, " (%d new)", arr->new_cnt);
|
||||
if (arr->exp_cnt)
|
||||
fprintf(stderr, " ( + %d for expansion)", arr->exp_cnt);
|
||||
- if (status_msg)
|
||||
- fprintf(stderr, " %s", status_msg);
|
||||
- fprintf(stderr, ".\n");
|
||||
+ fprintf(stderr, " %s.\n", status_msg);
|
||||
}
|
||||
|
||||
static int name_matches(char *found, char *required, char *homehost, int require_homehost)
|
||||
diff --git a/Create.c b/Create.c
|
||||
index 9ea19de0..c84c1ac8 100644
|
||||
--- a/Create.c
|
||||
+++ b/Create.c
|
||||
@@ -83,7 +83,7 @@ int default_layout(struct supertype *st, int level, int verbose)
|
||||
|
||||
if (layout_map) {
|
||||
layout = map_name(layout_map, "default");
|
||||
- layout_name = map_num(layout_map, layout);
|
||||
+ layout_name = map_num_s(layout_map, layout);
|
||||
}
|
||||
if (layout_name && verbose > 0)
|
||||
pr_err("layout defaults to %s\n", layout_name);
|
||||
diff --git a/Detail.c b/Detail.c
|
||||
index 95d4cc70..ce7a8445 100644
|
||||
--- a/Detail.c
|
||||
+++ b/Detail.c
|
||||
@@ -495,8 +495,8 @@ int Detail(char *dev, struct context *c)
|
||||
if (array.state & (1 << MD_SB_CLEAN)) {
|
||||
if ((array.level == 0) ||
|
||||
(array.level == LEVEL_LINEAR))
|
||||
- arrayst = map_num(sysfs_array_states,
|
||||
- sra->array_state);
|
||||
+ arrayst = map_num_s(sysfs_array_states,
|
||||
+ sra->array_state);
|
||||
else
|
||||
arrayst = "clean";
|
||||
} else {
|
||||
diff --git a/Grow.c b/Grow.c
|
||||
index 18c5719b..8a242b0f 100644
|
||||
--- a/Grow.c
|
||||
+++ b/Grow.c
|
||||
@@ -547,7 +547,7 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha
|
||||
if (s->consistency_policy != CONSISTENCY_POLICY_RESYNC &&
|
||||
s->consistency_policy != CONSISTENCY_POLICY_PPL) {
|
||||
pr_err("Operation not supported for consistency policy %s\n",
|
||||
- map_num(consistency_policies, s->consistency_policy));
|
||||
+ map_num_s(consistency_policies, s->consistency_policy));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -578,14 +578,14 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha
|
||||
|
||||
if (sra->consistency_policy == (unsigned)s->consistency_policy) {
|
||||
pr_err("Consistency policy is already %s\n",
|
||||
- map_num(consistency_policies, s->consistency_policy));
|
||||
+ map_num_s(consistency_policies, s->consistency_policy));
|
||||
ret = 1;
|
||||
goto free_info;
|
||||
} else if (sra->consistency_policy != CONSISTENCY_POLICY_RESYNC &&
|
||||
sra->consistency_policy != CONSISTENCY_POLICY_PPL) {
|
||||
pr_err("Current consistency policy is %s, cannot change to %s\n",
|
||||
- map_num(consistency_policies, sra->consistency_policy),
|
||||
- map_num(consistency_policies, s->consistency_policy));
|
||||
+ map_num_s(consistency_policies, sra->consistency_policy),
|
||||
+ map_num_s(consistency_policies, s->consistency_policy));
|
||||
ret = 1;
|
||||
goto free_info;
|
||||
}
|
||||
@@ -704,8 +704,8 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha
|
||||
}
|
||||
|
||||
ret = sysfs_set_str(sra, NULL, "consistency_policy",
|
||||
- map_num(consistency_policies,
|
||||
- s->consistency_policy));
|
||||
+ map_num_s(consistency_policies,
|
||||
+ s->consistency_policy));
|
||||
if (ret)
|
||||
pr_err("Failed to change array consistency policy\n");
|
||||
|
||||
@@ -2241,7 +2241,7 @@ size_change_error:
|
||||
info.new_layout = UnSet;
|
||||
if (info.array.level == 6 && info.new_level == UnSet) {
|
||||
char l[40], *h;
|
||||
- strcpy(l, map_num(r6layout, info.array.layout));
|
||||
+ strcpy(l, map_num_s(r6layout, info.array.layout));
|
||||
h = strrchr(l, '-');
|
||||
if (h && strcmp(h, "-6") == 0) {
|
||||
*h = 0;
|
||||
@@ -2266,7 +2266,7 @@ size_change_error:
|
||||
info.new_layout = info.array.layout;
|
||||
else if (info.array.level == 5 && info.new_level == 6) {
|
||||
char l[40];
|
||||
- strcpy(l, map_num(r5layout, info.array.layout));
|
||||
+ strcpy(l, map_num_s(r5layout, info.array.layout));
|
||||
strcat(l, "-6");
|
||||
info.new_layout = map_name(r6layout, l);
|
||||
} else {
|
||||
diff --git a/Query.c b/Query.c
|
||||
index 23fbf8aa..adcd231e 100644
|
||||
--- a/Query.c
|
||||
+++ b/Query.c
|
||||
@@ -93,7 +93,7 @@ int Query(char *dev)
|
||||
else {
|
||||
printf("%s: %s %s %d devices, %d spare%s. Use mdadm --detail for more detail.\n",
|
||||
dev, human_size_brief(larray_size,IEC),
|
||||
- map_num(pers, level), raid_disks,
|
||||
+ map_num_s(pers, level), raid_disks,
|
||||
spare_disks, spare_disks == 1 ? "" : "s");
|
||||
}
|
||||
st = guess_super(fd);
|
||||
@@ -131,7 +131,7 @@ int Query(char *dev)
|
||||
dev,
|
||||
info.disk.number, info.array.raid_disks,
|
||||
activity,
|
||||
- map_num(pers, info.array.level),
|
||||
+ map_num_s(pers, info.array.level),
|
||||
mddev);
|
||||
if (st->ss == &super0)
|
||||
put_md_name(mddev);
|
||||
diff --git a/maps.c b/maps.c
|
||||
index a4fd2797..20fcf719 100644
|
||||
--- a/maps.c
|
||||
+++ b/maps.c
|
||||
@@ -166,6 +166,30 @@ mapping_t sysfs_array_states[] = {
|
||||
{ NULL, ARRAY_UNKNOWN_STATE }
|
||||
};
|
||||
|
||||
+/**
|
||||
+ * map_num_s() - Safer alternative of map_num() function.
|
||||
+ * @map: map to search.
|
||||
+ * @num: key to match.
|
||||
+ *
|
||||
+ * Shall be used only if key existence is quaranted.
|
||||
+ *
|
||||
+ * Return: Pointer to name of the element.
|
||||
+ */
|
||||
+char *map_num_s(mapping_t *map, int num)
|
||||
+{
|
||||
+ char *ret = map_num(map, num);
|
||||
+
|
||||
+ assert(ret);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * map_num() - get element name by key.
|
||||
+ * @map: map to search.
|
||||
+ * @num: key to match.
|
||||
+ *
|
||||
+ * Return: Pointer to name of the element or NULL.
|
||||
+ */
|
||||
char *map_num(mapping_t *map, int num)
|
||||
{
|
||||
while (map->name) {
|
||||
diff --git a/mdadm.c b/mdadm.c
|
||||
index 26299b2e..be40686c 100644
|
||||
--- a/mdadm.c
|
||||
+++ b/mdadm.c
|
||||
@@ -280,8 +280,8 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
fprintf(stderr, "-%c", opt);
|
||||
fprintf(stderr, " would set mdadm mode to \"%s\", but it is already set to \"%s\".\n",
|
||||
- map_num(modes, newmode),
|
||||
- map_num(modes, mode));
|
||||
+ map_num_s(modes, newmode),
|
||||
+ map_num_s(modes, mode));
|
||||
exit(2);
|
||||
} else if (!mode && newmode) {
|
||||
mode = newmode;
|
||||
@@ -544,7 +544,7 @@ int main(int argc, char *argv[])
|
||||
switch(s.level) {
|
||||
default:
|
||||
pr_err("layout not meaningful for %s arrays.\n",
|
||||
- map_num(pers, s.level));
|
||||
+ map_num_s(pers, s.level));
|
||||
exit(2);
|
||||
case UnSet:
|
||||
pr_err("raid level must be given before layout.\n");
|
||||
@@ -1248,10 +1248,10 @@ int main(int argc, char *argv[])
|
||||
if (option_index > 0)
|
||||
pr_err(":option --%s not valid in %s mode\n",
|
||||
long_options[option_index].name,
|
||||
- map_num(modes, mode));
|
||||
+ map_num_s(modes, mode));
|
||||
else
|
||||
pr_err("option -%c not valid in %s mode\n",
|
||||
- opt, map_num(modes, mode));
|
||||
+ opt, map_num_s(modes, mode));
|
||||
exit(2);
|
||||
|
||||
}
|
||||
@@ -1276,7 +1276,7 @@ int main(int argc, char *argv[])
|
||||
if (s.consistency_policy != CONSISTENCY_POLICY_UNKNOWN &&
|
||||
s.consistency_policy != CONSISTENCY_POLICY_JOURNAL) {
|
||||
pr_err("--write-journal is not supported with consistency policy: %s\n",
|
||||
- map_num(consistency_policies, s.consistency_policy));
|
||||
+ map_num_s(consistency_policies, s.consistency_policy));
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -1285,12 +1285,12 @@ int main(int argc, char *argv[])
|
||||
s.consistency_policy != CONSISTENCY_POLICY_UNKNOWN) {
|
||||
if (s.level <= 0) {
|
||||
pr_err("--consistency-policy not meaningful with level %s.\n",
|
||||
- map_num(pers, s.level));
|
||||
+ map_num_s(pers, s.level));
|
||||
exit(2);
|
||||
} else if (s.consistency_policy == CONSISTENCY_POLICY_JOURNAL &&
|
||||
!s.journaldisks) {
|
||||
pr_err("--write-journal is required for consistency policy: %s\n",
|
||||
- map_num(consistency_policies, s.consistency_policy));
|
||||
+ map_num_s(consistency_policies, s.consistency_policy));
|
||||
exit(2);
|
||||
} else if (s.consistency_policy == CONSISTENCY_POLICY_PPL &&
|
||||
s.level != 5) {
|
||||
@@ -1300,14 +1300,14 @@ int main(int argc, char *argv[])
|
||||
(!s.bitmap_file ||
|
||||
strcmp(s.bitmap_file, "none") == 0)) {
|
||||
pr_err("--bitmap is required for consistency policy: %s\n",
|
||||
- map_num(consistency_policies, s.consistency_policy));
|
||||
+ map_num_s(consistency_policies, s.consistency_policy));
|
||||
exit(2);
|
||||
} else if (s.bitmap_file &&
|
||||
strcmp(s.bitmap_file, "none") != 0 &&
|
||||
s.consistency_policy != CONSISTENCY_POLICY_BITMAP &&
|
||||
s.consistency_policy != CONSISTENCY_POLICY_JOURNAL) {
|
||||
pr_err("--bitmap is not compatible with consistency policy: %s\n",
|
||||
- map_num(consistency_policies, s.consistency_policy));
|
||||
+ map_num_s(consistency_policies, s.consistency_policy));
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
diff --git a/mdadm.h b/mdadm.h
|
||||
index cd72e711..09915a00 100644
|
||||
--- a/mdadm.h
|
||||
+++ b/mdadm.h
|
||||
@@ -770,7 +770,7 @@ extern int restore_stripes(int *dest, unsigned long long *offsets,
|
||||
#endif
|
||||
|
||||
#define SYSLOG_FACILITY LOG_DAEMON
|
||||
-
|
||||
+extern char *map_num_s(mapping_t *map, int num);
|
||||
extern char *map_num(mapping_t *map, int num);
|
||||
extern int map_name(mapping_t *map, char *name);
|
||||
extern mapping_t r0layout[], r5layout[], r6layout[],
|
||||
diff --git a/super-ddf.c b/super-ddf.c
|
||||
index 3f304cdc..8cda23a7 100644
|
||||
--- a/super-ddf.c
|
||||
+++ b/super-ddf.c
|
||||
@@ -1477,13 +1477,13 @@ static void examine_vds(struct ddf_super *sb)
|
||||
printf("\n");
|
||||
printf(" unit[%d] : %d\n", i, be16_to_cpu(ve->unit));
|
||||
printf(" state[%d] : %s, %s%s\n", i,
|
||||
- map_num(ddf_state, ve->state & 7),
|
||||
+ map_num_s(ddf_state, ve->state & 7),
|
||||
(ve->state & DDF_state_morphing) ? "Morphing, ": "",
|
||||
(ve->state & DDF_state_inconsistent)? "Not Consistent" : "Consistent");
|
||||
printf(" init state[%d] : %s\n", i,
|
||||
- map_num(ddf_init_state, ve->init_state&DDF_initstate_mask));
|
||||
+ map_num_s(ddf_init_state, ve->init_state & DDF_initstate_mask));
|
||||
printf(" access[%d] : %s\n", i,
|
||||
- map_num(ddf_access, (ve->init_state & DDF_access_mask) >> 6));
|
||||
+ map_num_s(ddf_access, (ve->init_state & DDF_access_mask) >> 6));
|
||||
printf(" Name[%d] : %.16s\n", i, ve->name);
|
||||
examine_vd(i, sb, ve->guid);
|
||||
}
|
||||
diff --git a/super-intel.c b/super-intel.c
|
||||
index 6ff336ee..ba3bd41f 100644
|
||||
--- a/super-intel.c
|
||||
+++ b/super-intel.c
|
||||
@@ -5625,7 +5625,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||
free(dev);
|
||||
free(dv);
|
||||
pr_err("imsm does not support consistency policy %s\n",
|
||||
- map_num(consistency_policies, s->consistency_policy));
|
||||
+ map_num_s(consistency_policies, s->consistency_policy));
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/super0.c b/super0.c
|
||||
index b79b97a9..61c9ec1d 100644
|
||||
--- a/super0.c
|
||||
+++ b/super0.c
|
||||
@@ -288,7 +288,7 @@ static void export_examine_super0(struct supertype *st)
|
||||
{
|
||||
mdp_super_t *sb = st->sb;
|
||||
|
||||
- printf("MD_LEVEL=%s\n", map_num(pers, sb->level));
|
||||
+ printf("MD_LEVEL=%s\n", map_num_s(pers, sb->level));
|
||||
printf("MD_DEVICES=%d\n", sb->raid_disks);
|
||||
if (sb->minor_version >= 90)
|
||||
printf("MD_UUID=%08x:%08x:%08x:%08x\n",
|
||||
diff --git a/super1.c b/super1.c
|
||||
index a12a5bc8..e3e2f954 100644
|
||||
--- a/super1.c
|
||||
+++ b/super1.c
|
||||
@@ -671,7 +671,7 @@ static void export_examine_super1(struct supertype *st)
|
||||
int len = 32;
|
||||
int layout;
|
||||
|
||||
- printf("MD_LEVEL=%s\n", map_num(pers, __le32_to_cpu(sb->level)));
|
||||
+ printf("MD_LEVEL=%s\n", map_num_s(pers, __le32_to_cpu(sb->level)));
|
||||
printf("MD_DEVICES=%d\n", __le32_to_cpu(sb->raid_disks));
|
||||
for (i = 0; i < 32; i++)
|
||||
if (sb->set_name[i] == '\n' || sb->set_name[i] == '\0') {
|
||||
diff --git a/sysfs.c b/sysfs.c
|
||||
index 2995713d..0d98a65f 100644
|
||||
--- a/sysfs.c
|
||||
+++ b/sysfs.c
|
||||
@@ -689,7 +689,7 @@ int sysfs_set_array(struct mdinfo *info, int vers)
|
||||
if (info->array.level < 0)
|
||||
return 0; /* FIXME */
|
||||
rv |= sysfs_set_str(info, NULL, "level",
|
||||
- map_num(pers, info->array.level));
|
||||
+ map_num_s(pers, info->array.level));
|
||||
if (info->reshape_active && info->delta_disks != UnSet)
|
||||
raid_disks -= info->delta_disks;
|
||||
rv |= sysfs_set_num(info, NULL, "raid_disks", raid_disks);
|
||||
@@ -724,9 +724,10 @@ int sysfs_set_array(struct mdinfo *info, int vers)
|
||||
}
|
||||
|
||||
if (info->consistency_policy == CONSISTENCY_POLICY_PPL) {
|
||||
- if (sysfs_set_str(info, NULL, "consistency_policy",
|
||||
- map_num(consistency_policies,
|
||||
- info->consistency_policy))) {
|
||||
+ char *policy = map_num_s(consistency_policies,
|
||||
+ info->consistency_policy);
|
||||
+
|
||||
+ if (sysfs_set_str(info, NULL, "consistency_policy", policy)) {
|
||||
pr_err("This kernel does not support PPL. Falling back to consistency-policy=resync.\n");
|
||||
info->consistency_policy = CONSISTENCY_POLICY_RESYNC;
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 52c67fcdd6dadc4138ecad73e65599551804d445 Mon Sep 17 00:00:00 2001
|
||||
From: Coly Li <colyli@suse.de>
|
||||
Date: Tue, 15 Feb 2022 21:34:15 +0800
|
||||
Subject: [PATCH 12/12] mdadm/systemd: remove KillMode=none from service file
|
||||
|
||||
For mdadm's systemd configuration, current systemd KillMode is "none" in
|
||||
following service files,
|
||||
- mdadm-grow-continue@.service
|
||||
- mdmon@.service
|
||||
|
||||
This "none" mode is strongly againsted by systemd developers (see man 5
|
||||
systemd.kill for "KillMode=" section), and is considering to remove in
|
||||
future systemd version.
|
||||
|
||||
As systemd developer explained in disuccsion, the systemd kill process
|
||||
is,
|
||||
1. send the signal specified by KillSignal= to the list of processes (if
|
||||
any), TERM is the default
|
||||
2. wait until either the target of process(es) exit or a timeout expires
|
||||
3. if the timeout expires send the signal specified by FinalKillSignal=,
|
||||
KILL is the default
|
||||
|
||||
For "control-group", all remaining processes will receive the SIGTERM
|
||||
signal (by default) and if there are still processes after a period f
|
||||
time, they will get the SIGKILL signal.
|
||||
|
||||
For "mixed", only the main process will receive the SIGTERM signal, and
|
||||
if there are still processes after a period of time, all remaining
|
||||
processes (including the main one) will receive the SIGKILL signal.
|
||||
|
||||
From the above comment, currently KillMode=control-group is a proper
|
||||
kill mode. Since control-gropu is the default kill mode, the fix can be
|
||||
simply removing KillMode=none line from the service file, then the
|
||||
default mode will take effect.
|
||||
|
||||
Signed-off-by: Coly Li <colyli@suse.de>
|
||||
Cc: Benjamin Brunner <bbrunner@suse.com>
|
||||
Cc: Franck Bui <fbui@suse.de>
|
||||
Cc: Jes Sorensen <jes@trained-monkey.org>
|
||||
Cc: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
Cc: Neil Brown <neilb@suse.de>
|
||||
Cc: Xiao Ni <xni@redhat.com>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
systemd/mdadm-grow-continue@.service | 1 -
|
||||
systemd/mdmon@.service | 1 -
|
||||
2 files changed, 2 deletions(-)
|
||||
|
||||
diff --git a/systemd/mdadm-grow-continue@.service b/systemd/mdadm-grow-continue@.service
|
||||
index 5c667d2a..9fdc8ec7 100644
|
||||
--- a/systemd/mdadm-grow-continue@.service
|
||||
+++ b/systemd/mdadm-grow-continue@.service
|
||||
@@ -14,4 +14,3 @@ ExecStart=BINDIR/mdadm --grow --continue /dev/%I
|
||||
StandardInput=null
|
||||
StandardOutput=null
|
||||
StandardError=null
|
||||
-KillMode=none
|
||||
diff --git a/systemd/mdmon@.service b/systemd/mdmon@.service
|
||||
index 85a3a7c5..77533958 100644
|
||||
--- a/systemd/mdmon@.service
|
||||
+++ b/systemd/mdmon@.service
|
||||
@@ -25,4 +25,3 @@ Type=forking
|
||||
# it out) and systemd will remove it when transitioning from
|
||||
# initramfs to rootfs.
|
||||
#PIDFile=/run/mdadm/%I.pid
|
||||
-KillMode=none
|
||||
--
|
||||
2.31.1
|
||||
|
20
mdadm.spec
20
mdadm.spec
@ -1,7 +1,7 @@
|
||||
Name: mdadm
|
||||
Version: 4.2
|
||||
# extraversion is used to define rhel internal version
|
||||
%define extraversion 2
|
||||
%define extraversion 3
|
||||
Release: %{extraversion}%{?dist}
|
||||
Summary: The mdadm program controls Linux md devices (software RAID arrays)
|
||||
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
|
||||
@ -19,7 +19,19 @@ Source8: raid-check.service
|
||||
|
||||
# Build without -Werror.
|
||||
Patch00: disable-Werror.patch
|
||||
Patch01: 0001-Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch
|
||||
Patch01: Revert-mdadm-fix-coredump-of-mdadm-monitor-r.patch
|
||||
Patch02: 0001-Unify-error-message.patch
|
||||
Patch03: 0002-mdadm-Fix-double-free.patch
|
||||
Patch04: 0003-Grow_reshape-Add-r0-grow-size-error-message-and-upda.patch
|
||||
Patch05: 0004-udev-adapt-rules-to-systemd-v247.patch
|
||||
Patch06: 0005-Replace-error-prone-signal-with-sigaction.patch
|
||||
Patch07: 0006-mdadm-Respect-config-file-location-in-man.patch
|
||||
Patch08: 0007-mdadm-Update-ReadMe.patch
|
||||
Patch09: 0008-mdadm-Update-config-man-regarding-default-files-and-.patch
|
||||
Patch10: 0009-mdadm-Update-config-manual.patch
|
||||
Patch11: 0010-Create-Build-use-default_layout.patch
|
||||
Patch12: 0011-mdadm-add-map_num_s.patch
|
||||
Patch13: 0012-mdadm-systemd-remove-KillMode-none-from-service-file.patch
|
||||
|
||||
# Fedora customization patches
|
||||
Patch97: mdadm-3.3-udev.patch
|
||||
@ -93,6 +105,10 @@ install -m644 %{SOURCE6} %{buildroot}/etc/libreport/events.d
|
||||
/etc/libreport/events.d/*
|
||||
|
||||
%changelog
|
||||
* Mon May 30 2022 Xiao Ni <xni@redhat.com> - 4.2-3
|
||||
- Update mdadm to latest upstream
|
||||
- Resolves rhbz#2052029, rhbz#1974184
|
||||
|
||||
* Thu Feb 24 2022 Xiao Ni <xni@redhat.com> - 4.2-2
|
||||
- mdadm re-add fault/removed disk failed
|
||||
- Resolves rhbz#2047567
|
||||
|
Loading…
Reference in New Issue
Block a user