Commit 2dba6a91 authored by Daniel P. Berrange's avatar Daniel P. Berrange Committed by NeilBrown

md: don't delay reboot by 1 second if no MD devices exist

The md_notify_reboot() method includes a call to mdelay(1000),
to deal with "exotic SCSI devices" which are too volatile on
reboot. The delay is unconditional. Even if the machine does
not have any block devices, let alone MD devices, the kernel
shutdown sequence is slowed down.

1 second does not matter much with physical hardware, but with
certain virtualization use cases any wasted time in the bootup
& shutdown sequence counts for alot.

* drivers/md/md.c: md_notify_reboot() - only impose a delay if
  there was at least one MD device to be stopped during reboot
Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 7e841526
...@@ -8075,12 +8075,13 @@ static int md_notify_reboot(struct notifier_block *this, ...@@ -8075,12 +8075,13 @@ static int md_notify_reboot(struct notifier_block *this,
{ {
struct list_head *tmp; struct list_head *tmp;
mddev_t *mddev; mddev_t *mddev;
int need_delay = 0;
if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) { if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) {
printk(KERN_INFO "md: stopping all md devices.\n"); printk(KERN_INFO "md: stopping all md devices.\n");
for_each_mddev(mddev, tmp) for_each_mddev(mddev, tmp) {
if (mddev_trylock(mddev)) { if (mddev_trylock(mddev)) {
/* Force a switch to readonly even array /* Force a switch to readonly even array
* appears to still be in use. Hence * appears to still be in use. Hence
...@@ -8089,13 +8090,16 @@ static int md_notify_reboot(struct notifier_block *this, ...@@ -8089,13 +8090,16 @@ static int md_notify_reboot(struct notifier_block *this,
md_set_readonly(mddev, 100); md_set_readonly(mddev, 100);
mddev_unlock(mddev); mddev_unlock(mddev);
} }
need_delay = 1;
}
/* /*
* certain more exotic SCSI devices are known to be * certain more exotic SCSI devices are known to be
* volatile wrt too early system reboots. While the * volatile wrt too early system reboots. While the
* right place to handle this issue is the given * right place to handle this issue is the given
* driver, we do want to have a safe RAID driver ... * driver, we do want to have a safe RAID driver ...
*/ */
mdelay(1000*1); if (need_delay)
mdelay(1000*1);
} }
return NOTIFY_DONE; return NOTIFY_DONE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment