Extend --wait-clean to checkpoint resync

Root file systems backed by external metadata arrays need to be
explicitly checkpointed near the time the rootfs is marked readonly as
userspace will not have an opportunity to react to the final shutdown of
the array.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2008-09-28 12:12:06 -07:00
parent 0dd3ba30aa
commit 7146ec6a1e
2 changed files with 13 additions and 3 deletions

View File

@ -686,6 +686,9 @@ int WaitClean(char *dev)
tm.tv_sec = 5;
tm.tv_usec = 0;
/* give mdmon a chance to checkpoint resync */
sysfs_set_str(mdi, NULL, "sync_action", "idle");
FD_ZERO(&fds);
/* wait for array_state to be clean */

13
mdadm.8
View File

@ -1016,9 +1016,16 @@ listed, otherwise it will return failure.
.TP
.BR \-\-wait\-clean
For each md device given, wait for the array to be marked clean before
returning. For native arrays this returns immediately as the kernel
handles dirty-clean transistions at shutdown.
For each md device given, arrange for the array to be marked clean as
soon as possible. Also, quiesce resync so that the monitor for external
metadata arrays (mdmon) has an opportunity to checkpoint the resync
position.
.I mdadm
will return with success if the array uses external metadata and we
successfully waited. For native arrays this returns immediately as the
kernel handles both dirty-clean transitions and resync checkpointing in
the kernel at shutdown. No action is taken if safe-mode handling is
disabled.
.SH For Incremental Assembly mode:
.TP