summaryrefslogtreecommitdiffstats
path: root/sysfs.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-09-28 12:12:06 -0700
committerDan Williams <dan.j.williams@intel.com>2008-10-15 14:15:51 -0700
commit0dd3ba30aa1fbab2d7e62fca5169789ceb62b3f1 (patch)
tree9eafafde61587a4635c9cb8bbfa3d9d26c7c2a86 /sysfs.c
parent593add1b56877a6881419c2496eb26dd1f82d39b (diff)
downloadmdadm-0dd3ba30aa1fbab2d7e62fca5169789ceb62b3f1.tar.gz
mdadm-0dd3ba30aa1fbab2d7e62fca5169789ceb62b3f1.tar.xz
mdadm-0dd3ba30aa1fbab2d7e62fca5169789ceb62b3f1.zip
--wait-clean: shorten timeout
Set the safemode timeout to a small value to get the array marked clean as soon as possible. We don't write 'clean' directly as it may cause mdmon to miss a 'write-pending' event. Include a couple fixes to sysfs_set_safemode(): 1/ 0 pad the milliseconds field 2/ workaround input truncation in the kernel Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'sysfs.c')
-rw-r--r--sysfs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sysfs.c b/sysfs.c
index 291a1dc..23d2f18 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -436,9 +436,10 @@ int sysfs_set_safemode(struct mdinfo *sra, unsigned long ms)
char delay[30];
sec = ms / 1000;
- msec = ms - (sec * 1000);
+ msec = ms % 1000;
- sprintf(delay, "%ld.%ld", sec, msec);
+ sprintf(delay, "%ld.%03ld\n", sec, msec);
+ /* this '\n' ^ needed for kernels older than 2.6.28 */
return sysfs_set_str(sra, NULL, "safe_mode_delay", delay);
}