Make sure that cam(4)'s dashutdown handler runs before DEVICE_SHUTDOWN().
authorImre Vadász <imre@vdsz.com>
Sun, 30 Jul 2017 14:08:58 +0000 (16:08 +0200)
committerImre Vadász <imre@vdsz.com>
Sun, 30 Jul 2017 18:56:06 +0000 (20:56 +0200)
commitc022ffc9484ecf07d8d7c4fb918d84a6154367be
tree3ca7fd87ff92ebf4f6907c3dd2db3bbd41924f82
parentfbb06a6802c717bad2a5380805b6643f73ee8f32
Make sure that cam(4)'s dashutdown handler runs before DEVICE_SHUTDOWN().

This meant, that the DEVICE_SHUTDOWN() callback of scsi drivers was running
before the final SYNCHRONIZE_CACHE scsi command was sent by cam(4). For
most drivers this was still fine, since usually the DEVICE_SHUTDOWN()
callback - if it's even implemented - only flushes the command queue.

This change avoids freezing at the end of shutdown which was known to
happen with the twa(4), and virtio_scsi(4) drivers.

The SHUTDOWN_PRI_SECOND priority is selected, because it's so far unused,
and inbetween existing handlers in the shutdown_post_sync phase, that are
at SHUTDOWN_PRI_FIRST and at SHUTDOWN_PRI_DEFAULT.

Tested-by: swildner (on twa(4)), ivadasz (on virtio_scsi(4))
sys/bus/cam/scsi/scsi_da.c