• Nicholas Bellinger's avatar
    target: Fix race with SCF_SEND_DELAYED_TAS handling · 9afdedac
    Nicholas Bellinger authored
    commit 310d3d31 upstream.
    
    This patch fixes a race between setting of SCF_SEND_DELAYED_TAS
    in transport_send_task_abort(), and check of the same bit in
    transport_check_aborted_status().
    
    It adds a __transport_check_aborted_status() version that is
    used by target_execute_cmd() when se_cmd->t_state_lock is
    held, and a transport_check_aborted_status() wrapper for
    all other existing callers.
    
    Also, it handles the case where the check happens before
    transport_send_task_abort() gets called.  For this, go
    ahead and set SCF_SEND_DELAYED_TAS early when necessary,
    and have transport_send_task_abort() send the abort.
    
    Cc: Quinn Tran <quinn.tran@qlogic.com>
    Cc: Himanshu Madhani <himanshu.madhani@qlogic.com>
    Cc: Sagi Grimberg <sagig@mellanox.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Hannes Reinecke <hare@suse.de>
    Cc: Andy Grover <agrover@redhat.com>
    Cc: Mike Christie <mchristi@redhat.com>
    Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
    [ luis: backported to 3.16: based on Nicholas' backport to 3.14 ]
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    9afdedac
target_core_transport.c 83.6 KB