]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Monitor.c
Monitor: refresh mdstat fd after select
[thirdparty/mdadm.git] / Monitor.c
index 2d6b3b9016e4e4f608e230bfe16e1642c5875016..80a3200fec6b752d38cb205373fc65e8f8ea5754 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -216,8 +216,6 @@ int Monitor(struct mddev_dev *devlist,
                if (mdstat)
                        free_mdstat(mdstat);
                mdstat = mdstat_read(oneshot ? 0 : 1, 0);
-               if (!mdstat)
-                       mdstat_close();
 
                for (st = statelist; st; st = st->next)
                        if (check_array(st, mdstat, c->test, &info,
@@ -238,8 +236,10 @@ int Monitor(struct mddev_dev *devlist,
                if (!new_found) {
                        if (oneshot)
                                break;
-                       else
+                       else {
                                mdstat_wait(c->delay);
+                               mdstat_close();
+                       }
                }
                c->test = 0;