Accepting request 1193244 from Base:System
OBS-URL: https://build.opensuse.org/request/show/1193244 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=149
This commit is contained in:
commit
80c1387a28
59
0006-util.c-change-devnm-to-const-in-mdmon-functions.patch
Normal file
59
0006-util.c-change-devnm-to-const-in-mdmon-functions.patch
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
From b0f4e8e30f38d83f7e3f53d01d72d4cb3b4d42d7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
|
||||||
|
Date: Tue, 7 May 2024 05:38:55 +0200
|
||||||
|
Subject: [PATCH] util.c: change devnm to const in mdmon functions
|
||||||
|
Git-commit: b0f4e8e30f38d83f7e3f53d01d72d4cb3b4d42d7
|
||||||
|
Patch-mainline: mdadm-4.3+
|
||||||
|
References: bsc#1225307
|
||||||
|
|
||||||
|
Devnm shall not be changed inside mdmon_running()
|
||||||
|
and mdmon_pid() functions, change this parameter to const.
|
||||||
|
|
||||||
|
Signed-off-by: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
|
||||||
|
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||||
|
Signed-off-by: Coly Li <colyli@suse.de>
|
||||||
|
---
|
||||||
|
mdadm.h | 4 ++--
|
||||||
|
util.c | 4 ++--
|
||||||
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
|
index 2ff3e463..1ba541fc 100644
|
||||||
|
--- a/mdadm.h
|
||||||
|
+++ b/mdadm.h
|
||||||
|
@@ -1768,8 +1768,8 @@ extern int is_subarray_active(char *subarray, char *devname);
|
||||||
|
extern int open_subarray(char *dev, char *subarray, struct supertype *st, int quiet);
|
||||||
|
extern struct superswitch *version_to_superswitch(char *vers);
|
||||||
|
|
||||||
|
-extern int mdmon_running(char *devnm);
|
||||||
|
-extern int mdmon_pid(char *devnm);
|
||||||
|
+extern int mdmon_running(const char *devnm);
|
||||||
|
+extern int mdmon_pid(const char *devnm);
|
||||||
|
extern int check_env(char *name);
|
||||||
|
extern __u32 random32(void);
|
||||||
|
extern void random_uuid(__u8 *buf);
|
||||||
|
diff --git a/util.c b/util.c
|
||||||
|
index 4fbf11c4..e2b490e1 100644
|
||||||
|
--- a/util.c
|
||||||
|
+++ b/util.c
|
||||||
|
@@ -1902,7 +1902,7 @@ unsigned long long min_recovery_start(struct mdinfo *array)
|
||||||
|
return recovery_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int mdmon_pid(char *devnm)
|
||||||
|
+int mdmon_pid(const char *devnm)
|
||||||
|
{
|
||||||
|
char path[100];
|
||||||
|
char pid[10];
|
||||||
|
@@ -1922,7 +1922,7 @@ int mdmon_pid(char *devnm)
|
||||||
|
return atoi(pid);
|
||||||
|
}
|
||||||
|
|
||||||
|
-int mdmon_running(char *devnm)
|
||||||
|
+int mdmon_running(const char *devnm)
|
||||||
|
{
|
||||||
|
int pid = mdmon_pid(devnm);
|
||||||
|
if (pid <= 0)
|
||||||
|
--
|
||||||
|
2.35.3
|
||||||
|
|
125
0007-Wait-for-mdmon-when-it-is-stared-via-systemd.patch
Normal file
125
0007-Wait-for-mdmon-when-it-is-stared-via-systemd.patch
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
From aa1cc5815d2b14a8b47add18cfaa8264e19c10ce Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
|
||||||
|
Date: Tue, 7 May 2024 05:38:56 +0200
|
||||||
|
Subject: [PATCH] Wait for mdmon when it is stared via systemd
|
||||||
|
Git-commit: aa1cc5815d2b14a8b47add18cfaa8264e19c10ce
|
||||||
|
Patch-mainline: mdadm-4.3+
|
||||||
|
References: bsc#1225307
|
||||||
|
|
||||||
|
When mdmon is being started it may need few seconds to start.
|
||||||
|
For now, we didn't wait for it. Introduce wait_for_mdmon()
|
||||||
|
function, which waits up to 5 seconds for mdmon to start completely.
|
||||||
|
|
||||||
|
Signed-off-by: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
|
||||||
|
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||||
|
Signed-off-by: Coly Li <colyli@suse.de>
|
||||||
|
---
|
||||||
|
Assemble.c | 4 ++--
|
||||||
|
Grow.c | 7 ++++---
|
||||||
|
mdadm.h | 2 ++
|
||||||
|
util.c | 29 +++++++++++++++++++++++++++++
|
||||||
|
4 files changed, 37 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Assemble.c b/Assemble.c
|
||||||
|
index f5e9ab1f..83dced19 100644
|
||||||
|
--- a/Assemble.c
|
||||||
|
+++ b/Assemble.c
|
||||||
|
@@ -2173,8 +2173,8 @@ int assemble_container_content(struct supertype *st, int mdfd,
|
||||||
|
if (!mdmon_running(st->container_devnm))
|
||||||
|
start_mdmon(st->container_devnm);
|
||||||
|
ping_monitor(st->container_devnm);
|
||||||
|
- if (mdmon_running(st->container_devnm) &&
|
||||||
|
- st->update_tail == NULL)
|
||||||
|
+ if (wait_for_mdmon(st->container_devnm) == MDADM_STATUS_SUCCESS &&
|
||||||
|
+ !st->update_tail)
|
||||||
|
st->update_tail = &st->updates;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index 87ed9214..1923c27c 100644
|
||||||
|
--- a/Grow.c
|
||||||
|
+++ b/Grow.c
|
||||||
|
@@ -2134,7 +2134,7 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
if (!mdmon_running(st->container_devnm))
|
||||||
|
start_mdmon(st->container_devnm);
|
||||||
|
ping_monitor(container);
|
||||||
|
- if (mdmon_running(st->container_devnm) == false) {
|
||||||
|
+ if (wait_for_mdmon(st->container_devnm) != MDADM_STATUS_SUCCESS) {
|
||||||
|
pr_err("No mdmon found. Grow cannot continue.\n");
|
||||||
|
goto release;
|
||||||
|
}
|
||||||
|
@@ -3218,7 +3218,8 @@ static int reshape_array(char *container, int fd, char *devname,
|
||||||
|
if (!mdmon_running(container))
|
||||||
|
start_mdmon(container);
|
||||||
|
ping_monitor(container);
|
||||||
|
- if (mdmon_running(container) && st->update_tail == NULL)
|
||||||
|
+ if (wait_for_mdmon(container) == MDADM_STATUS_SUCCESS &&
|
||||||
|
+ !st->update_tail)
|
||||||
|
st->update_tail = &st->updates;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -5173,7 +5174,7 @@ int Grow_continue_command(char *devname, int fd, struct context *c)
|
||||||
|
start_mdmon(container);
|
||||||
|
ping_monitor(container);
|
||||||
|
|
||||||
|
- if (mdmon_running(container) == false) {
|
||||||
|
+ if (wait_for_mdmon(container) != MDADM_STATUS_SUCCESS) {
|
||||||
|
pr_err("No mdmon found. Grow cannot continue.\n");
|
||||||
|
ret_val = 1;
|
||||||
|
goto Grow_continue_command_exit;
|
||||||
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
|
index 1ba541fc..b71d7b32 100644
|
||||||
|
--- a/mdadm.h
|
||||||
|
+++ b/mdadm.h
|
||||||
|
@@ -1770,6 +1770,8 @@ extern struct superswitch *version_to_superswitch(char *vers);
|
||||||
|
|
||||||
|
extern int mdmon_running(const char *devnm);
|
||||||
|
extern int mdmon_pid(const char *devnm);
|
||||||
|
+extern mdadm_status_t wait_for_mdmon(const char *devnm);
|
||||||
|
+
|
||||||
|
extern int check_env(char *name);
|
||||||
|
extern __u32 random32(void);
|
||||||
|
extern void random_uuid(__u8 *buf);
|
||||||
|
diff --git a/util.c b/util.c
|
||||||
|
index e2b490e1..bf79742f 100644
|
||||||
|
--- a/util.c
|
||||||
|
+++ b/util.c
|
||||||
|
@@ -1932,6 +1932,35 @@ int mdmon_running(const char *devnm)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * wait_for_mdmon() - Waits for mdmon within specified time.
|
||||||
|
+ * @devnm: Device for which mdmon should start.
|
||||||
|
+ *
|
||||||
|
+ * Function waits for mdmon to start. It may need few seconds
|
||||||
|
+ * to start, we set timeout to 5, it should be sufficient.
|
||||||
|
+ * Do not wait if mdmon has been started.
|
||||||
|
+ *
|
||||||
|
+ * Return: MDADM_STATUS_SUCCESS if mdmon is running, error code otherwise.
|
||||||
|
+ */
|
||||||
|
+mdadm_status_t wait_for_mdmon(const char *devnm)
|
||||||
|
+{
|
||||||
|
+ const time_t mdmon_timeout = 5;
|
||||||
|
+ time_t start_time = time(0);
|
||||||
|
+
|
||||||
|
+ if (mdmon_running(devnm))
|
||||||
|
+ return MDADM_STATUS_SUCCESS;
|
||||||
|
+
|
||||||
|
+ pr_info("Waiting for mdmon to start\n");
|
||||||
|
+ while (time(0) - start_time < mdmon_timeout) {
|
||||||
|
+ sleep_for(0, MSEC_TO_NSEC(200), true);
|
||||||
|
+ if (mdmon_running(devnm))
|
||||||
|
+ return MDADM_STATUS_SUCCESS;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ pr_err("Timeout waiting for mdmon\n");
|
||||||
|
+ return MDADM_STATUS_ERROR;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int start_mdmon(char *devnm)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
--
|
||||||
|
2.35.3
|
||||||
|
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Jul 6 15:43:04 UTC 2024 - Coly Li <colyli@suse.de>
|
||||||
|
|
||||||
|
- util.c: change devnm to const in mdmon functions (bsc#1225307)
|
||||||
|
0006-util.c-change-devnm-to-const-in-mdmon-functions.patch
|
||||||
|
- Wait for mdmon when it is stared via systemd (bsc#1225307)
|
||||||
|
0007-Wait-for-mdmon-when-it-is-stared-via-systemd.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Feb 23 10:46:16 UTC 2024 - pgajdos@suse.com
|
Fri Feb 23 10:46:16 UTC 2024 - pgajdos@suse.com
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@ Patch2: 0002-monitor-refactor-checkpoint-update.patch
|
|||||||
Patch3: 0003-Super-intel-Fix-first-checkpoint-restart.patch
|
Patch3: 0003-Super-intel-Fix-first-checkpoint-restart.patch
|
||||||
Patch4: 0004-Grow-Move-update_tail-assign-to-Grow_reshape.patch
|
Patch4: 0004-Grow-Move-update_tail-assign-to-Grow_reshape.patch
|
||||||
Patch5: 0005-Add-understanding-output-section-in-man.patch
|
Patch5: 0005-Add-understanding-output-section-in-man.patch
|
||||||
|
Patch6: 0006-util.c-change-devnm-to-const-in-mdmon-functions.patch
|
||||||
|
Patch7: 0007-Wait-for-mdmon-when-it-is-stared-via-systemd.patch
|
||||||
Patch1001: 1001-display-timeout-status.patch
|
Patch1001: 1001-display-timeout-status.patch
|
||||||
Patch1002: 1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch
|
Patch1002: 1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch
|
||||||
Patch1003: 1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch
|
Patch1003: 1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch
|
||||||
|
Loading…
Reference in New Issue
Block a user