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
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);
+ }
+}
* 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, '@'},
{"readonly", 0, 0, 'o'},
{"readwrite", 0, 0, 'w'},
{"no-degraded",0,0, NoDegraded },
+ {"wait", 0, 0, 'W'},
/* For Detail/Examine */
{"brief", 0, 0, 'b'},
" --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"
;
*/
" --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[] =
.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
case 'S':
case 'o':
case 'w':
+ case 'W':
case 'K': if (!mode) newmode = MISC; break;
}
if (mode && newmode == mode) {
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",
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");
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) {
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,