aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2011-09-23 05:40:45 -0400
committerNeilBrown <neilb@suse.de>2011-09-23 05:54:04 -0400
commit2dba6a911c284603d2085fec1e2d3c142f58a010 (patch)
tree8db93ad2131afd519b9d618f12841ec5d981c082 /drivers/md/md.c
parent7e841526263b3e0042a423513147dfd06c8e998d (diff)
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>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 5c95ccb59500..accae4422c06 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8075,12 +8075,13 @@ static int md_notify_reboot(struct notifier_block *this,
8075{ 8075{
8076 struct list_head *tmp; 8076 struct list_head *tmp;
8077 mddev_t *mddev; 8077 mddev_t *mddev;
8078 int need_delay = 0;
8078 8079
8079 if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) { 8080 if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) {
8080 8081
8081 printk(KERN_INFO "md: stopping all md devices.\n"); 8082 printk(KERN_INFO "md: stopping all md devices.\n");
8082 8083
8083 for_each_mddev(mddev, tmp) 8084 for_each_mddev(mddev, tmp) {
8084 if (mddev_trylock(mddev)) { 8085 if (mddev_trylock(mddev)) {
8085 /* Force a switch to readonly even array 8086 /* Force a switch to readonly even array
8086 * appears to still be in use. Hence 8087 * appears to still be in use. Hence
@@ -8089,13 +8090,16 @@ static int md_notify_reboot(struct notifier_block *this,
8089 md_set_readonly(mddev, 100); 8090 md_set_readonly(mddev, 100);
8090 mddev_unlock(mddev); 8091 mddev_unlock(mddev);
8091 } 8092 }
8093 need_delay = 1;
8094 }
8092 /* 8095 /*
8093 * certain more exotic SCSI devices are known to be 8096 * certain more exotic SCSI devices are known to be
8094 * volatile wrt too early system reboots. While the 8097 * volatile wrt too early system reboots. While the
8095 * right place to handle this issue is the given 8098 * right place to handle this issue is the given
8096 * driver, we do want to have a safe RAID driver ... 8099 * driver, we do want to have a safe RAID driver ...
8097 */ 8100 */
8098 mdelay(1000*1); 8101 if (need_delay)
8102 mdelay(1000*1);
8099 } 8103 }
8100 return NOTIFY_DONE; 8104 return NOTIFY_DONE;
8101} 8105}