--wait or -W will wait for resync activity to finish on the given devices.
This commit is contained in:
parent
e336254463
commit
b90c0e9a12
|
@ -17,6 +17,8 @@ Changes Prior to this release
|
|||
kernel, and it not reset when the reshape finishes.
|
||||
- Change 'Device Size' to 'Used Dev Size' because it only shows how
|
||||
much of each device is actually used, not how big they are.
|
||||
- --wait or -W will wait for resync activity to finish on the given
|
||||
devices.
|
||||
|
||||
Changes Prior to 2.5.6 release
|
||||
- Fix bug which meant "bitmap=xxx" in mdadm.conf was not handled
|
||||
|
|
35
Monitor.c
35
Monitor.c
|
@ -553,3 +553,38 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mail
|
|||
syslog(priority, "%s event detected on md device %s", event, dev);
|
||||
}
|
||||
}
|
||||
|
||||
/* Not really Monitor but ... */
|
||||
int Wait(char *dev)
|
||||
{
|
||||
struct stat stb;
|
||||
int devnum;
|
||||
int rv = 1;
|
||||
|
||||
if (stat(dev, &stb) != 0) {
|
||||
fprintf(stderr, Name ": Cannot find %s: %s\n", dev,
|
||||
strerror(errno));
|
||||
return 2;
|
||||
}
|
||||
if (major(stb.st_rdev) == MD_MAJOR)
|
||||
devnum = minor(stb.st_rdev);
|
||||
else
|
||||
devnum = -minor(stb.st_rdev)/16;
|
||||
|
||||
while(1) {
|
||||
struct mdstat_ent *ms = mdstat_read(1, 0);
|
||||
struct mdstat_ent *e;
|
||||
|
||||
for (e=ms ; e; e=e->next)
|
||||
if (e->devnum == devnum)
|
||||
break;
|
||||
|
||||
if (!e || e->percent < 0) {
|
||||
free_mdstat(ms);
|
||||
return rv;
|
||||
}
|
||||
free(ms);
|
||||
rv = 0;
|
||||
mdstat_wait(5);
|
||||
}
|
||||
}
|
||||
|
|
7
ReadMe.c
7
ReadMe.c
|
@ -91,8 +91,8 @@ char Version[] = Name " - v2.5.6 - 9 November 2006\n";
|
|||
* At the time if writing, there is only minimal support.
|
||||
*/
|
||||
|
||||
char short_options[]="-ABCDEFGQhVXvqbc:i:l:p:m:n:x:u:c:d:z:U:sarfRSow1tye:";
|
||||
char short_bitmap_auto_options[]="-ABCDEFGQhVXvqb:c:i:l:p:m:n:x:u:c:d:z:U:sa:rfRSow1tye:";
|
||||
char short_options[]="-ABCDEFGQhVXWvqbc:i:l:p:m:n:x:u:c:d:z:U:sarfRSow1tye:";
|
||||
char short_bitmap_auto_options[]="-ABCDEFGQhVXWvqb:c:i:l:p:m:n:x:u:c:d:z:U:sa:rfRSow1tye:";
|
||||
|
||||
struct option long_options[] = {
|
||||
{"manage", 0, 0, '@'},
|
||||
|
@ -160,6 +160,7 @@ struct option long_options[] = {
|
|||
{"readonly", 0, 0, 'o'},
|
||||
{"readwrite", 0, 0, 'w'},
|
||||
{"no-degraded",0,0, NoDegraded },
|
||||
{"wait", 0, 0, 'W'},
|
||||
|
||||
/* For Detail/Examine */
|
||||
{"brief", 0, 0, 'b'},
|
||||
|
@ -296,6 +297,7 @@ char OptionHelp[] =
|
|||
" --readonly -o : mark array as readonly\n"
|
||||
" --readwrite -w : mark array as readwrite\n"
|
||||
" --zero-superblock : erase the MD superblock from a device.\n"
|
||||
" --wait -W : wait for recovery/resync/reshape to finish.\n"
|
||||
;
|
||||
*/
|
||||
|
||||
|
@ -459,6 +461,7 @@ char Help_misc[] =
|
|||
" --readonly -o : mark array as readonly\n"
|
||||
" --readwrite -w : mark array as readwrite\n"
|
||||
" --test -t : exit status 0 if ok, 1 if degrade, 2 if dead, 4 if missing\n"
|
||||
" --wait -W : wait for resync/rebuild/recovery to finish\n"
|
||||
;
|
||||
|
||||
char Help_monitor[] =
|
||||
|
|
8
mdadm.8
8
mdadm.8
|
@ -931,6 +931,14 @@ the exit status of
|
|||
.I mdadm
|
||||
is set to reflect the status of the device.
|
||||
|
||||
.TP
|
||||
.BR -W ", " --wait
|
||||
For each md device given, wait for any resync, recovery, or reshape
|
||||
activity to finish before returning.
|
||||
.I mdadm
|
||||
will return with success if it actually waited for every device
|
||||
listed, otherwise it will return failure.
|
||||
|
||||
.SH For Monitor mode:
|
||||
.TP
|
||||
.BR -m ", " --mail
|
||||
|
|
5
mdadm.c
5
mdadm.c
|
@ -201,6 +201,7 @@ int main(int argc, char *argv[])
|
|||
case 'S':
|
||||
case 'o':
|
||||
case 'w':
|
||||
case 'W':
|
||||
case 'K': if (!mode) newmode = MISC; break;
|
||||
}
|
||||
if (mode && newmode == mode) {
|
||||
|
@ -742,6 +743,7 @@ int main(int argc, char *argv[])
|
|||
case O(MISC,'X'):
|
||||
case O(MISC,'o'):
|
||||
case O(MISC,'w'):
|
||||
case O(MISC,'W'):
|
||||
if (devmode && devmode != opt &&
|
||||
(devmode == 'E' || (opt == 'E' && devmode != 'Q'))) {
|
||||
fprintf(stderr, Name ": --examine/-E cannot be given with -%c\n",
|
||||
|
@ -1138,7 +1140,6 @@ int main(int argc, char *argv[])
|
|||
bitmap_file, bitmap_chunk, write_behind, delay);
|
||||
break;
|
||||
case MISC:
|
||||
|
||||
if (devmode == 'E') {
|
||||
if (devlist == NULL && !scan) {
|
||||
fprintf(stderr, Name ": No devices to examine\n");
|
||||
|
@ -1219,6 +1220,8 @@ int main(int argc, char *argv[])
|
|||
rv |= Query(dv->devname); continue;
|
||||
case 'X':
|
||||
rv |= ExamineBitmap(dv->devname, brief, ss); continue;
|
||||
case 'W':
|
||||
rv |= Wait(dv->devname); continue;
|
||||
}
|
||||
mdfd = open_mddev(dv->devname, 1);
|
||||
if (mdfd>=0) {
|
||||
|
|
1
mdadm.h
1
mdadm.h
|
@ -421,6 +421,7 @@ extern int Monitor(mddev_dev_t devlist,
|
|||
int dosyslog, int test, char *pidfile);
|
||||
|
||||
extern int Kill(char *dev, int force, int quiet);
|
||||
extern int Wait(char *dev);
|
||||
|
||||
extern int CreateBitmap(char *filename, int force, char uuid[16],
|
||||
unsigned long chunksize, unsigned long daemon_sleep,
|
||||
|
|
Loading…
Reference in New Issue