[kernel/f15] Add patch to fix 1 second delay from MD driver during shutdown (rhbz 740645)

Josh Boyer jwboyer at fedoraproject.org
Fri Sep 23 16:24:15 UTC 2011


commit a949670cf06e4496cafdbf3a61fedaaea4087417
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Fri Sep 23 11:44:36 2011 -0400

    Add patch to fix 1 second delay from MD driver during shutdown (rhbz 740645)

 kernel.spec                                        |    7 ++
 ...delay-reboot-by-1-second-if-no-MD-devices.patch |  110 ++++++++++++++++++++
 2 files changed, 117 insertions(+), 0 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index df0b984..344d332 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -694,6 +694,9 @@ Patch21008: cifs-fix-possible-memory-corruption-in-CIFSFindNext.patch
 Patch21009: TPM-Call-tpm_transmit-with-correct-size.patch
 Patch21010: TPM-Zero-buffer-after-copying-to-userspace.patch
 
+# rhbz #740645
+Patch21011: md-dont-delay-reboot-by-1-second-if-no-MD-devices.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1257,6 +1260,9 @@ ApplyPatch cifs-fix-possible-memory-corruption-in-CIFSFindNext.patch
 ApplyPatch TPM-Call-tpm_transmit-with-correct-size.patch
 ApplyPatch TPM-Zero-buffer-after-copying-to-userspace.patch
 
+#rhbz 740645
+ApplyPatch md-dont-delay-reboot-by-1-second-if-no-MD-devices.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -1878,6 +1884,7 @@ fi
 
 %changelog
 * Fri Sep 23 2011 Josh Boyer <jwboyer at redhat.com>
+- Add patch to fix 1 second delay from MD driver during shutdown (rhbz 740645)
 - CVE-2011-1161 CVE-2011-1162: tpm: infoleaks
 
 * Thu Sep 22 2011 Dennis Gilmore <dennis at ausil.us>
diff --git a/md-dont-delay-reboot-by-1-second-if-no-MD-devices.patch b/md-dont-delay-reboot-by-1-second-if-no-MD-devices.patch
new file mode 100644
index 0000000..0ce4896
--- /dev/null
+++ b/md-dont-delay-reboot-by-1-second-if-no-MD-devices.patch
@@ -0,0 +1,110 @@
+Path: news.gmane.org!not-for-mail
+From: "Daniel P. Berrange" <berrange at redhat.com>
+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 at gmane.org
+Message-ID: <1316770845-18171-1-git-send-email-berrange at 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 at dough.gmane.org
+NNTP-Posting-Date: Fri, 23 Sep 2011 09:41:40 +0000 (UTC)
+Cc: linux-raid at vger.kernel.org, linux-kernel at vger.kernel.org,
+	"Daniel P. Berrange" <berrange at redhat.com>
+To: Neil Brown <neilb at suse.de>
+Original-X-From: linux-raid-owner at vger.kernel.org Fri Sep 23 11:41:35 2011
+Return-path: <linux-raid-owner at vger.kernel.org>
+Envelope-to: linux-raid at lo.gmane.org
+Original-Received: from vger.kernel.org ([209.132.180.67])
+	by lo.gmane.org with esmtp (Exim 4.69)
+	(envelope-from <linux-raid-owner at vger.kernel.org>)
+	id 1R72GD-0001vh-7L
+	for linux-raid at lo.gmane.org; Fri, 23 Sep 2011 11:41:33 +0200
+Original-Received: (majordomo at vger.kernel.org) by vger.kernel.org via listexpand
+	id S1752806Ab1IWJlT (ORCPT <rfc822;linux-raid at m.gmane.org>);
+	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 <rfc822;linux-raid at vger.kernel.org>);
+	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 at vger.kernel.org
+Precedence: bulk
+List-ID: <linux-raid.vger.kernel.org>
+X-Mailing-List: linux-raid at vger.kernel.org
+Xref: news.gmane.org gmane.linux.raid:35508 gmane.linux.kernel:1194566
+Archived-At: <http://permalink.gmane.org/gmane.linux.raid/35508>
+
+From: "Daniel P. Berrange" <berrange at redhat.com>
+
+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 at redhat.com>
+---
+ 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 at vger.kernel.org
+More majordomo info at  http://vger.kernel.org/majordomo-info.html
+


More information about the scm-commits mailing list