diff options
author | Neil Brown <neilb@suse.de> | 2004-06-04 14:03:19 +0200 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2004-06-04 14:03:19 +0200 |
commit | dd0781e50555c32ff2f808ec46f4b03a5693ea47 (patch) | |
tree | a423ae6f7033fa5e05dcf60f2b3659e38c9d5cb7 /Monitor.c | |
parent | mdadm-1.5.0 (diff) | |
download | mdadm-dd0781e50555c32ff2f808ec46f4b03a5693ea47.tar.xz mdadm-dd0781e50555c32ff2f808ec46f4b03a5693ea47.zip |
mdadm-1.6.0mdadm-1.6.0
Diffstat (limited to 'Monitor.c')
-rw-r--r-- | Monitor.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -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; } |