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
This commit is contained in:
delphij 2009-04-07 16:40:31 +00:00
parent 5758952bad
commit ba65fe81aa

View File

@ -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;