Make writes to md/safe_mode_delay immediately effective.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, August 15, 2008 - 11:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=19052c...
Commit:     19052c0e85a3e9d3b7d190b29fcdbf0e6c105381
Parent:     2b12a4c524812fb3f6ee590a02e65b95c8c32229
Author:     NeilBrown <neilb@suse.de>
AuthorDate: Tue Aug 5 15:54:13 2008 +1000
Committer:  NeilBrown <neilb@suse.de>
CommitDate: Tue Aug 5 15:56:31 2008 +1000

    Make writes to md/safe_mode_delay immediately effective.
    
    If we reduce the 'safe_mode_delay', it could still wait for the old
    delay to completely expire before doing anything about safe_mode.
    Thus the effect if the change is delayed.
    
    To make the effect more immediate, run the timeout function
    immediately if the delay was reduced.  This may cause it to run
    slightly earlier that required, but that is the safer option.
    
    Signed-off-by: NeilBrown <neilb@suse.de>
---
 drivers/md/md.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index c7aae66..48afe4f 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2393,6 +2393,8 @@ static void analyze_sbs(mddev_t * mddev)
 
 }
 
+static void md_safemode_timeout(unsigned long data);
+
 static ssize_t
 safe_delay_show(mddev_t *mddev, char *page)
 {
@@ -2432,9 +2434,12 @@ safe_delay_store(mddev_t *mddev, const char *cbuf, size_t len)
 	if (msec == 0)
 		mddev->safemode_delay = 0;
 	else {
+		unsigned long old_delay = mddev->safemode_delay;
 		mddev->safemode_delay = (msec*HZ)/1000;
 		if (mddev->safemode_delay == 0)
 			mddev->safemode_delay = 1;
+		if (mddev->safemode_delay < old_delay)
+			md_safemode_timeout((unsigned long)mddev);
 	}
 	return len;
 }
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Make writes to md/safe_mode_delay immediately effective., Linux Kernel Mailing ..., (Fri Aug 15, 11:59 am)