freebsd-dev/sys/dev/mps
Warner Losh 57aa9163fd Fix leak in state machine for commands.
When we get a device departed message from the firmware, we send a TARGET_REST
to the device to let the firmware know we're done and as part of the recovery
process. This will abort all the commands. While the documentation says the IOC
is responsible for writing the completion message for all the commands pending
with an aborted status, we sometimes have queued commands for the target that
haven't been completed so are in the INQUEUE state. So, when we later complete
the pending CCB as aborted, these commands are freed and we hit the "state not
busy" panic.

Elsewhere where we dequeue commands, we move the state to BUSY from INQUEUE. Do
that here as well. In talking to Ken, Scott and Justin, they recommended a
series of tests to see if this is 100% safe. Those tests are ongoing, but
preliminary tests suggest this is safe as we see no duplicate completions when
we hit this case at work. We have a machine that has a dodgy powersupply which
usually doesn't apply power to a few drives, but sometimes does when the machine
is under heavy load so we get a rash of the connect / disconnect messages over
half an hour. Without this change, we'd see state not busy panic. With this
change, the drives just annoyingly come and go without affecting the rest of the
machine, but without a complete error injection test suite, it's hard to know if
all edge cases are now covered or not.

Discussed with: scottl, ken, gibbs
2019-11-24 15:24:05 +00:00
..
mpi
mps_config.c
mps_ioctl.h
mps_mapping.c
mps_mapping.h
mps_pci.c Add PNP info to PCI attachments of cbb, cxgb, ida, iwn, ixl, ixlv, 2018-09-26 17:12:30 +00:00
mps_sas_lsi.c Fix bugs in recovery path and improve cm tracking 2019-07-08 20:20:01 +00:00
mps_sas.c Fix leak in state machine for commands. 2019-11-24 15:24:05 +00:00
mps_sas.h
mps_table.c Add missing break statements. Coverity CID 1400446. 2019-03-27 12:25:46 +00:00
mps_table.h
mps_user.c Fix busy status leak in case of incorrect passthrough args. 2019-05-30 14:13:09 +00:00
mps.c Fix bugs in recovery path and improve cm tracking 2019-07-08 20:20:01 +00:00
mpsvar.h Fix bugs in recovery path and improve cm tracking 2019-07-08 20:20:01 +00:00