summaryrefslogtreecommitdiff
path: root/mdstat.c
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@intel.com>2020-09-09 10:31:17 +0200
committerJes Sorensen <jsorensen@fb.com>2020-10-14 11:31:39 -0400
commite2308733910a157b0a4d4e78721f239d44b91a24 (patch)
treeddef0e3ff7475c0262f130d1441b00878e80175f /mdstat.c
parent2ce091724031e18f522994ffd1e5eb0dc404bcba (diff)
downloadmdadm-e2308733910a157b0a4d4e78721f239d44b91a24.tar.gz
Monitor: refresh mdstat fd after select
After 52209d6ee118 ("Monitor: release /proc/mdstat fd when no arrays present") mdstat fd is closed if mdstat is empty or cannot be opened. It causes that monitor is not able to select on mdstat. Select doesn't fail because it gets valid descriptor to a different resource. As a result any new event will be unnoticed until timeout (delay). Refresh mdstat after wake up, don't poll on wrong resource. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'mdstat.c')
-rw-r--r--mdstat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mdstat.c b/mdstat.c
index 20577a3..48559e6 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -135,7 +135,6 @@ struct mdstat_ent *mdstat_read(int hold, int start)
if (hold && mdstat_fd != -1) {
off_t offset = lseek(mdstat_fd, 0L, 0);
if (offset == (off_t)-1) {
- mdstat_close();
return NULL;
}
fd = dup(mdstat_fd);
@@ -312,7 +311,8 @@ void mdstat_wait(int seconds)
if (mdstat_fd >= 0) {
FD_SET(mdstat_fd, &fds);
maxfd = mdstat_fd;
- }
+ } else
+ return;
tm.tv_sec = seconds;
tm.tv_usec = 0;
select(maxfd + 1, NULL, NULL, &fds, &tm);