summaryrefslogtreecommitdiffstats
path: root/Monitor.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2004-06-04 12:03:19 +0000
committerNeil Brown <neilb@suse.de>2004-06-04 12:03:19 +0000
commitdd0781e50555c32ff2f808ec46f4b03a5693ea47 (patch)
treea423ae6f7033fa5e05dcf60f2b3659e38c9d5cb7 /Monitor.c
parent98c6faba80e6db0693f99faf5c6525ef4f1fb680 (diff)
downloadmdadm-dd0781e50555c32ff2f808ec46f4b03a5693ea47.tar.gz
mdadm-dd0781e50555c32ff2f808ec46f4b03a5693ea47.tar.xz
mdadm-dd0781e50555c32ff2f808ec46f4b03a5693ea47.zip
mdadm-1.6.0mdadm-1.6.0
Diffstat (limited to 'Monitor.c')
-rw-r--r--Monitor.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/Monitor.c b/Monitor.c
index 2d3693b..021a967 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -185,11 +185,11 @@ int Monitor(mddev_dev_t devlist,
if (mdstat)
free_mdstat(mdstat);
- mdstat = mdstat_read();
+ mdstat = mdstat_read(oneshot?0:1);
for (st=statelist; st; st=st->next) {
mdu_array_info_t array;
- struct mdstat_ent *mse;
+ struct mdstat_ent *mse = NULL, *mse2;
char *dev = st->devname;
int fd;
unsigned int i;
@@ -228,16 +228,18 @@ int Monitor(mddev_dev_t devlist,
struct stat stb;
if (fstat(fd, &stb) == 0 &&
(S_IFMT&stb.st_mode)==S_IFBLK) {
- if (MINOR(stb.st_rdev) == 9)
+ if (MAJOR(stb.st_rdev) == MD_MAJOR)
st->devnum = MINOR(stb.st_rdev);
else
st->devnum = -1- (MINOR(stb.st_rdev)>>6);
}
}
- for (mse = mdstat ; mse ; mse=mse->next)
- if (mse->devnum == st->devnum)
- mse->devnum = MAXINT; /* flag it as "used" */
+ for (mse2 = mdstat ; mse2 ; mse2=mse2->next)
+ if (mse2->devnum == st->devnum) {
+ mse2->devnum = MAXINT; /* flag it as "used" */
+ mse = mse2;
+ }
if (st->utime == array.utime &&
st->failed == array.failed_disks &&
@@ -349,6 +351,7 @@ int Monitor(mddev_dev_t devlist,
free(st);
continue;
}
+ close(fd);
st->utime = 0;
st->next = statelist;
st->err = 1;
@@ -414,7 +417,7 @@ int Monitor(mddev_dev_t devlist,
if (oneshot)
break;
else
- sleep(period);
+ mdstat_wait(period);
}
test = 0;
}