svn commit: r190810 - head/sys/dev/hptmv

Xin LI delphij at FreeBSD.org
Tue Apr 7 09:40:33 PDT 2009


Author: delphij
Date: Tue Apr  7 16:40:31 2009
New Revision: 190810
URL: http://svn.freebsd.org/changeset/base/190810

Log:
  When multiple cards are present, register a shutdown handler for each card
  instead of just register one for the first adapter.  Without doing this
  there would be some data loss upon shutdown because data could be ignored
  when flushing to disk.
  
  MFC after:	3 days

Modified:
  head/sys/dev/hptmv/entry.c

Modified: head/sys/dev/hptmv/entry.c
==============================================================================
--- head/sys/dev/hptmv/entry.c	Tue Apr  7 16:38:25 2009	(r190809)
+++ head/sys/dev/hptmv/entry.c	Tue Apr  7 16:40:31 2009	(r190810)
@@ -2138,14 +2138,15 @@ hpt_attach(device_t dev)
 	xpt_action((union ccb *)ccb);
 	free(ccb, M_DEVBUF);
 
-	/* Register shutdown handler, and start the work thread. */
-	if (device_get_unit(dev) == 0) {
-		pAdapter->eh = EVENTHANDLER_REGISTER(shutdown_final, 
-			hpt_shutdown, dev, SHUTDOWN_PRI_DEFAULT);
-		if (pAdapter->eh)
-			launch_worker_thread();
-		else
-			hpt_printk(("shutdown event registration failed\n"));
+	/* Register a shutdown handler to flush data for the current adapter */
+	pAdapter->eh =  EVENTHANDLER_REGISTER(shutdown_final, 
+		hpt_shutdown, dev, SHUTDOWN_PRI_DEFAULT);
+	if (pAdapter->eh == NULL) {
+	    device_printf(pAdapter->hpt_dev,
+		"shutdown event registration failed\n");
+	} else if (device_get_unit(dev) == 0) {
+		/* Start the work thread.  XXX */
+		launch_worker_thread();
 	}
 
 	return 0;


More information about the svn-src-all mailing list