All of lore.kernel.org
 help / color / mirror / Atom feed
* + cciss-add-reboot-notifier-support-to-driver.patch added to -mm tree
@ 2007-02-22  3:19 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2007-02-22  3:19 UTC (permalink / raw)
  To: mm-commits; +Cc: mikem, mike.miller


The patch titled
     cciss: add reboot notifier support to driver
has been added to the -mm tree.  Its filename is
     cciss-add-reboot-notifier-support-to-driver.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: cciss: add reboot notifier support to driver
From: "Mike Miller (OS Dev)" <mikem@beardog.cca.cpqcorp.net>

This patch adds reboot_notifier support to cciss.  Changes in firmware make
this patch essential.  Without this patch there may be valid data left in the
controller's battery backed write cache (BBWC) on shutdown.  We found out the
hard way that the kernel does not call our cleanup routines on shutdown or
reboot.  It seems that only rmmod calls the cleanup.  Please consider this for
inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/block/cciss.c |   41 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff -puN drivers/block/cciss.c~cciss-add-reboot-notifier-support-to-driver drivers/block/cciss.c
--- a/drivers/block/cciss.c~cciss-add-reboot-notifier-support-to-driver
+++ a/drivers/block/cciss.c
@@ -45,6 +45,7 @@
 #include <linux/blkdev.h>
 #include <linux/genhd.h>
 #include <linux/completion.h>
+#include <linux/reboot.h>
 
 #define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin))
 #define DRIVER_NAME "HP CISS Driver (v 3.6.14)"
@@ -132,6 +133,7 @@ static struct board_type products[] = {
 #define MAX_CTLR_ORIG 	8
 
 static ctlr_info_t *hba[MAX_CTLR];
+static int notify_count=0;
 
 static void do_cciss_request(request_queue_t *q);
 static irqreturn_t do_cciss_intr(int irq, void *dev_id);
@@ -142,6 +144,8 @@ static int cciss_ioctl(struct inode *ino
 static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo);
 
 static int cciss_revalidate(struct gendisk *disk);
+static int cciss_notify_reboot(struct notifier_block *this,
+					unsigned long code, void *x);
 static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk);
 static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
 			   int clear_all);
@@ -193,6 +197,36 @@ static struct block_device_operations cc
 	.revalidate_disk = cciss_revalidate,
 };
 
+static struct notifier_block cciss_notifier = {
+	.notifier_call  = cciss_notify_reboot,
+};
+
+static int cciss_notify_reboot(struct notifier_block *this,
+                            unsigned long code, void *x)
+{
+	int i, return_code;
+	char flush_buf[4];
+
+	if ((code == SYS_DOWN) || (code == SYS_HALT) ||
+					(code == SYS_POWER_OFF)) {
+		printk(KERN_INFO "cciss: stopping all cciss devices.\n");
+		/* double check that all controller entrys have been removed */
+		for (i = 0; i < MAX_CTLR; i++) {
+			if (hba[i] != NULL) {
+				printk(KERN_WARNING "cciss: removing "
+						"controller %d\n", i);
+				/* flush data in battery backed cache to disks */
+				memset(flush_buf, 0, 4);
+				return_code = sendcmd(CCISS_CACHE_FLUSH, i, flush_buf, 4, 								0, 0, 0, NULL, TYPE_CMD);
+				if(return_code != IO_OK) {
+					printk(KERN_WARNING "Error Flushing cache on "
+								" controller %d\n", i);
+				}
+			}
+		}
+	}
+	return NOTIFY_DONE;
+}
 /*
  * Enqueuing and dequeuing functions for cmdlists.
  */
@@ -3287,6 +3321,12 @@ static int __devinit cciss_init_one(stru
 	       ((hba[i]->nr_cmds + BITS_PER_LONG -
 		 1) / BITS_PER_LONG) * sizeof(unsigned long));
 
+	if (notify_count == 0) {
+		register_reboot_notifier(&cciss_notifier);
+		notify_count=1;
+	}
+
+
 #ifdef CCISS_DEBUG
 	printk(KERN_DEBUG "Scanning for drives on controller cciss%d\n", i);
 #endif				/* CCISS_DEBUG */
@@ -3494,6 +3534,7 @@ static void __exit cciss_cleanup(void)
 	int i;
 
 	pci_unregister_driver(&cciss_pci_driver);
+	unregister_reboot_notifier(&cciss_notifier);
 	/* double check that all controller entrys have been removed */
 	for (i = 0; i < MAX_CTLR; i++) {
 		if (hba[i] != NULL) {
_

Patches currently in -mm which might be from mikem@beardog.cca.cpqcorp.net are

cciss-fix-for-2tb-support.patch
cciss-add-reboot-notifier-support-to-driver.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-22  3:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-22  3:19 + cciss-add-reboot-notifier-support-to-driver.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.