• Bart Van Assche's avatar
    scsi: Avoid that .queuecommand() gets called for a blocked SCSI device · bbe9fb0d
    Bart Van Assche authored
    Several SCSI transport and LLD drivers surround code that does not
    tolerate concurrent calls of .queuecommand() with scsi_target_block() /
    scsi_target_unblock(). These last two functions use
    blk_mq_quiesce_queue() / blk_mq_unquiesce_queue() for scsi-mq request
    queues to prevent concurrent .queuecommand() calls. However, that is
    not sufficient to prevent .queuecommand() calls from scsi_send_eh_cmnd().
    Hence surround the .queuecommand() call from the SCSI error handler with
    code that avoids that .queuecommand() gets called in the blocked state.
    
    Note: converting the .queuecommand() call in scsi_send_eh_cmnd() into
    code that calls blk_get_request() + blk_execute_rq() is not an option
    since scsi_send_eh_cmnd() must be able to make forward progress even
    if all requests have been allocated.
    
    Cc: Ming Lei <ming.lei@redhat.com>
    Cc: Hannes Reinecke <hare@suse.de>
    Cc: Johannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
    Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    bbe9fb0d
scsi_error.c 68.1 KB