kernel - Fix CAM peripheral error handling
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 4 Feb 2018 19:13:03 +0000 (11:13 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 4 Feb 2018 19:13:03 +0000 (11:13 -0800)
commita9f09b75787c7fb9d408ac052485f6111364454d
tree3183fc915c7661cfc41dc85cc71ed459309df957
parent0e602b730b9056c4cf03e75a059f330627b5fb58
kernel - Fix CAM peripheral error handling

* cam_periph.c was bcopy()ing the *ENTIRE* saved ccb back to the
  original when working through certain error results.  This completely
  destroys linked list entry fields.

* Refactor by hacking a restore_ccb() function which does not copy
  over the link list entry fields or the callout structure.

* Fixes panics with CDs, particularly audio CDs, and can also fix
  other panics.

  Panics are related to situations where an AHCI error or errors occur
  while multiple CCBs are queued.

* Also always initialize the state tracking field for various scsi
  periphals to ensure that stale data does not result in improper
  processing in scsi/*.c's *done() functions.

Reported-by: htse
sys/bus/cam/cam_ccb.h
sys/bus/cam/cam_periph.c
sys/bus/cam/scsi/scsi_cd.c
sys/bus/cam/scsi/scsi_ch.c
sys/bus/cam/scsi/scsi_da.c
sys/bus/cam/scsi/scsi_pass.c
sys/bus/cam/scsi/scsi_sa.c
sys/bus/cam/scsi/scsi_sg.c