]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Extend --wait-clean to checkpoint resync
authorDan Williams <dan.j.williams@intel.com>
Sun, 28 Sep 2008 19:12:06 +0000 (12:12 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 15 Oct 2008 21:15:51 +0000 (14:15 -0700)
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>
Monitor.c
mdadm.8

index 8d8939cef7ad190def2619e6d3f6acb4f51512f2..a0803909b7608c884e0ea2b1b6af642d44208e3a 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -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 */
diff --git a/mdadm.8 b/mdadm.8
index 881b9dfbd8435d717f953d681a9e5339b8445855..41486e64fec03fc0d4c0d4a23e838e1a44adc1c2 100644 (file)
--- a/mdadm.8
+++ b/mdadm.8
@@ -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