Skip to content
  • James Smart's avatar
    nvme_fc: correct abort race condition on resets · 3efd6e8e
    James Smart authored
    
    
    During reset handling, there is live io completing while the reset
    is taking place. The reset path attempts to abort all outstanding io,
    counting the number of ios that were reset. It then waits for those
    ios to be reclaimed from the lldd before continuing.
    
    The transport's logic on io state and flag setting was poor, allowing
    ios to complete simultaneous to the abort request. The completed ios
    were counted, but as the completion had already occurred, the
    completion never reduced the count. As the count never zeros, the
    reset/delete never completes.
    
    Tighten it up by unconditionally changing the op state to completed
    when the io done handler is called.  The reset/abort path now changes
    the op state to aborted, but the abort only continues if the op
    state was live priviously. If complete, the abort is backed out.
    Thus proper counting of io aborts and their completions is working
    again.
    
    Also removed the TERMIO state on the op as it's redundant with the
    op's aborted state.
    
    Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
    Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
    3efd6e8e