Skip to content

Commit 2dba6a9

Browse files
berrangeneilbrown
authored andcommitted
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: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
1 parent 7e84152 commit 2dba6a9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎drivers/md/md.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8075,12 +8075,13 @@ static int md_notify_reboot(struct notifier_block *this,
80758075
{
80768076
struct list_head *tmp;
80778077
mddev_t *mddev;
8078+
int need_delay = 0;
80788079

80798080
if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) {
80808081

80818082
printk(KERN_INFO "md: stopping all md devices.\n");
80828083

8083-
for_each_mddev(mddev, tmp)
8084+
for_each_mddev(mddev, tmp) {
80848085
if (mddev_trylock(mddev)) {
80858086
/* Force a switch to readonly even array
80868087
* appears to still be in use. Hence
@@ -8089,13 +8090,16 @@ static int md_notify_reboot(struct notifier_block *this,
80898090
md_set_readonly(mddev, 100);
80908091
mddev_unlock(mddev);
80918092
}
8093+
need_delay = 1;
8094+
}
80928095
/*
80938096
* certain more exotic SCSI devices are known to be
80948097
* volatile wrt too early system reboots. While the
80958098
* right place to handle this issue is the given
80968099
* driver, we do want to have a safe RAID driver ...
80978100
*/
8098-
mdelay(1000*1);
8101+
if (need_delay)
8102+
mdelay(1000*1);
80998103
}
81008104
return NOTIFY_DONE;
81018105
}

0 commit comments

Comments
 (0)