5563a724f6
- There are some important fixes merged in mdadm upstream which should go with jsc#SLE-13700. This is the update from upstream mdadm including the important fixes we should have. - Detail: show correct raid level when the array is inactive (jsc#SLE-13700) 0095-Detail-show-correct-raid-level-when-the-array-is-ina.patch - Don't create bitmap for raid5 with journal disk (jsc#SLE-13700) 0096-Don-t-create-bitmap-for-raid5-with-journal-disk.patch - Monitor: refresh mdstat fd after select (jsc#SLE-13700) 0097-Monitor-refresh-mdstat-fd-after-select.patch - Monitor: stop notifing about containers. (jsc#SLE-13700) 0098-Monitor-stop-notifing-about-containers.patch - mdmonitor: set small delay once (jsc#SLE-13700) 0099-mdmonitor-set-small-delay-once.patch - Check if other Monitor instance running before fork. (jsc#SLE-13700) 0100-Check-if-other-Monitor-instance-running-before-fork.patch - Super1: allow RAID0 layout setting to be removed. (jsc#SLE-13700) 0101-Super1-allow-RAID0-layout-setting-to-be-removed.patch - Detail: fix segfault during IMSM raid creation (jsc#SLE-13700) 0102-Detail-fix-segfault-during-IMSM-raid-creation.patch - Create.c: close mdfd and generate uevent (jsc#SLE-13700) 0103-Create.c-close-mdfd-and-generate-uevent.patch - imsm: update num_data_stripes according to dev_size (jsc#SLE-13700) 0104-imsm-update-num_data_stripes-according-to-dev_size.patch - imsm: remove redundant calls to imsm_get_map (jsc#SLE-13700) OBS-URL: https://build.opensuse.org/request/show/853269 OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=191
104 lines
2.6 KiB
Diff
104 lines
2.6 KiB
Diff
From cab9c67d461c65a1138359f9f6d39636466b90e4 Mon Sep 17 00:00:00 2001
|
|
From: Blazej Kucman <blazej.kucman@intel.com>
|
|
Date: Wed, 9 Sep 2020 10:31:19 +0200
|
|
Subject: [PATCH 05/17] mdmonitor: set small delay once
|
|
|
|
If mdmonitor is awakened by event, set small delay once
|
|
to deal with udev and mdadm.
|
|
|
|
Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
|
|
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
|
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
---
|
|
Monitor.c | 14 +++++++++++++-
|
|
mdadm.h | 2 +-
|
|
mdstat.c | 18 +++++++++++++++---
|
|
3 files changed, 29 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/Monitor.c b/Monitor.c
|
|
index aed7a69..0fb4f77 100644
|
|
--- a/Monitor.c
|
|
+++ b/Monitor.c
|
|
@@ -128,6 +128,7 @@ int Monitor(struct mddev_dev *devlist,
|
|
char *mailfrom;
|
|
struct alert_info info;
|
|
struct mddev_ident *mdlist;
|
|
+ int delay_for_event = c->delay;
|
|
|
|
if (!mailaddr) {
|
|
mailaddr = conf_get_mailaddr();
|
|
@@ -249,7 +250,18 @@ int Monitor(struct mddev_dev *devlist,
|
|
break;
|
|
}
|
|
else {
|
|
- mdstat_wait(c->delay);
|
|
+ int wait_result = mdstat_wait(delay_for_event);
|
|
+
|
|
+ /*
|
|
+ * If mdmonitor is awaken by event, set small delay once
|
|
+ * to deal with udev and mdadm.
|
|
+ */
|
|
+ if (wait_result != 0) {
|
|
+ if (c->delay > 5)
|
|
+ delay_for_event = 5;
|
|
+ } else
|
|
+ delay_for_event = c->delay;
|
|
+
|
|
mdstat_close();
|
|
}
|
|
}
|
|
diff --git a/mdadm.h b/mdadm.h
|
|
index 399478b..4961c0f 100644
|
|
--- a/mdadm.h
|
|
+++ b/mdadm.h
|
|
@@ -628,7 +628,7 @@ struct mdstat_ent {
|
|
extern struct mdstat_ent *mdstat_read(int hold, int start);
|
|
extern void mdstat_close(void);
|
|
extern void free_mdstat(struct mdstat_ent *ms);
|
|
-extern void mdstat_wait(int seconds);
|
|
+extern int mdstat_wait(int seconds);
|
|
extern void mdstat_wait_fd(int fd, const sigset_t *sigmask);
|
|
extern int mddev_busy(char *devnm);
|
|
extern struct mdstat_ent *mdstat_by_component(char *name);
|
|
diff --git a/mdstat.c b/mdstat.c
|
|
index 48559e6..dd96cca 100644
|
|
--- a/mdstat.c
|
|
+++ b/mdstat.c
|
|
@@ -302,7 +302,17 @@ void mdstat_close(void)
|
|
mdstat_fd = -1;
|
|
}
|
|
|
|
-void mdstat_wait(int seconds)
|
|
+/*
|
|
+ * function: mdstat_wait
|
|
+ * Description: Function waits for event on mdstat.
|
|
+ * Parameters:
|
|
+ * seconds - timeout for waiting
|
|
+ * Returns:
|
|
+ * > 0 - detected event
|
|
+ * 0 - timeout
|
|
+ * < 0 - detected error
|
|
+ */
|
|
+int mdstat_wait(int seconds)
|
|
{
|
|
fd_set fds;
|
|
struct timeval tm;
|
|
@@ -312,10 +322,12 @@ void mdstat_wait(int seconds)
|
|
FD_SET(mdstat_fd, &fds);
|
|
maxfd = mdstat_fd;
|
|
} else
|
|
- return;
|
|
+ return -1;
|
|
+
|
|
tm.tv_sec = seconds;
|
|
tm.tv_usec = 0;
|
|
- select(maxfd + 1, NULL, NULL, &fds, &tm);
|
|
+
|
|
+ return select(maxfd + 1, NULL, NULL, &fds, &tm);
|
|
}
|
|
|
|
void mdstat_wait_fd(int fd, const sigset_t *sigmask)
|
|
--
|
|
2.26.2
|
|
|