[scsi] Avoid duplicate calls to scsicmd_close()
authorMichael Brown <mcb30@ipxe.org>
Thu, 9 Mar 2017 12:45:45 +0000 (12:45 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 9 Mar 2017 13:07:57 +0000 (13:07 +0000)
commit9db9221ea0e3a7a4b32cf7fbdb17a46af474ce2b
tree47cd05ed9dbe7f8ba87fb2790855b33bc7d26c37
parent9423a85f71b14af6f69897fe5172c60a34b28c42
[scsi] Avoid duplicate calls to scsicmd_close()

When a SCSI device is closed in error, the shutdown of the device's
block data interface will probably lead to any outstanding commands
being closed (by whichever object is currently connected to the block
data interface).  However, commands remain in the list of outstanding
commands until the final reference is dropped.  The result is that
scsidev_close() will make a second call to scsicmd_close() for each
command.  This is harmless, but produces confusing debug messages.

Fix by treating the outstanding command list as holding an explicit
reference to each command, and removing the command from the list of
outstanding commands in scsicmd_close().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/block/scsi.c