md: fix safe_mode buglet.
authorNeilBrown <neilb@suse.de>
Wed, 7 Aug 2013 23:20:32 +0000 (09:20 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 27 Aug 2013 06:05:43 +0000 (16:05 +1000)
Whe we set the safe_mode_timeout to a smaller value we trigger a timeout
immediately - otherwise the small value might not be honoured.
However if the previous timeout was 0 meaning "no timeout", we didn't.
This would mean that no timeout happens until the next write completes,
which could be a long time.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c

index bba87324c9b25ac40e3a46b791771996d8e3c9dc..16b0822fa24a8d1990deb11bf454628922ebec5e 100644 (file)
@@ -3429,7 +3429,7 @@ safe_delay_store(struct mddev *mddev, const char *cbuf, size_t len)
                mddev->safemode_delay = (msec*HZ)/1000;
                if (mddev->safemode_delay == 0)
                        mddev->safemode_delay = 1;
-               if (mddev->safemode_delay < old_delay)
+               if (mddev->safemode_delay < old_delay || old_delay == 0)
                        md_safemode_timeout((unsigned long)mddev);
        }
        return len;