• Daniel Drake's avatar
    libertas: handle command failure immediately · 9c3099f7
    Daniel Drake authored
    Fail commands immediately when the request cannot be sent to the hardware.
    
    This solves the following deadlock:
     1. Two commands are in the queue.
     2. The first command is sent, but causes a timeout, which kicks off an
        asynchronous device reset
     3. The second command is submitted to the device, and fails. The failure
        is noted but the existing code waits for the timeout handler to take
        care of the failure.
     4. The device reset kicks in, causing the device "surprise removed" flag
        to be set as the device disappears from the bus.
     5. lbs_thread notes this and enters "adapter removed; waiting to die"
        mode, without processing any further command timeouts.
    
    While adjusting lbs thread logic to handle this situation may be one way
    to fix this, it seems more practical to simplify handling of host_to_card
    failure so that the commands are failed immediately without waiting for
    more compliated timeout logic to kick in.
    Signed-off-by: default avatarDaniel Drake <dsd@laptop.org>
    Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
    9c3099f7
cmd.c 42.8 KB