Path: news.gmane.org!not-for-mail From: "Daniel P. Berrange" Newsgroups: gmane.linux.raid,gmane.linux.kernel Subject: [PATCH] md: don't delay reboot by 1 second if no MD devices exist Date: Fri, 23 Sep 2011 10:40:45 +0100 Lines: 65 Approved: news@gmane.org Message-ID: <1316770845-18171-1-git-send-email-berrange@redhat.com> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1316770900 21954 80.91.229.12 (23 Sep 2011 09:41:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 23 Sep 2011 09:41:40 +0000 (UTC) Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, "Daniel P. Berrange" To: Neil Brown Original-X-From: linux-raid-owner@vger.kernel.org Fri Sep 23 11:41:35 2011 Return-path: Envelope-to: linux-raid@lo.gmane.org Original-Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R72GD-0001vh-7L for linux-raid@lo.gmane.org; Fri, 23 Sep 2011 11:41:33 +0200 Original-Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752806Ab1IWJlT (ORCPT ); Fri, 23 Sep 2011 05:41:19 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:18969 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752669Ab1IWJlS (ORCPT ); Fri, 23 Sep 2011 05:41:18 -0400 Original-Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8N9fGuK005549 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 23 Sep 2011 05:41:16 -0400 Original-Received: from t500wlan.home.berrange.com.com (vpn1-7-26.ams2.redhat.com [10.36.7.26]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p8N9fDFC018631; Fri, 23 Sep 2011 05:41:14 -0400 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Original-Sender: linux-raid-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org Xref: news.gmane.org gmane.linux.raid:35508 gmane.linux.kernel:1194566 Archived-At: From: "Daniel P. Berrange" 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 --- drivers/md/md.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 5404b22..ef7ad8d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -8059,12 +8059,13 @@ static int md_notify_reboot(struct notifier_block *this, { struct list_head *tmp; mddev_t *mddev; + int need_delay = 0; if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) { printk(KERN_INFO "md: stopping all md devices.\n"); - for_each_mddev(mddev, tmp) + for_each_mddev(mddev, tmp) { if (mddev_trylock(mddev)) { /* Force a switch to readonly even array * appears to still be in use. Hence @@ -8073,13 +8074,16 @@ static int md_notify_reboot(struct notifier_block *this, md_set_readonly(mddev, 100); mddev_unlock(mddev); } + need_delay = 1; + } /* * certain more exotic SCSI devices are known to be * volatile wrt too early system reboots. While the * right place to handle this issue is the given * driver, we do want to have a safe RAID driver ... */ - mdelay(1000*1); + if (need_delay) + mdelay(1000*1); } return NOTIFY_DONE; } -- 1.7.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html