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