On Wed, May 17, 2023 at 04:09:27PM -0700, Bart Van Assche wrote: > Tell the block layer to rerun the queue after a delay instead of > immediately if the SCSI LLD decided to block the host. > > Note: neither scsi_run_host_queues() nor scsi_run_queue() are called > from the fast path. > > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > Cc: Ming Lei <ming.lei@xxxxxxxxxx> > Cc: Hannes Reinecke <hare@xxxxxxx> > Cc: John Garry <john.g.garry@xxxxxxxxxx> > Cc: Mike Christie <michael.christie@xxxxxxxxxx> > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > drivers/scsi/scsi_lib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > index e4f34217b879..b37718ebbbfc 100644 > --- a/drivers/scsi/scsi_lib.c > +++ b/drivers/scsi/scsi_lib.c > @@ -1767,7 +1767,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, > break; > case BLK_STS_RESOURCE: > case BLK_STS_ZONE_RESOURCE: > - if (scsi_device_blocked(sdev)) > + if (scsi_device_blocked(sdev) || shost->host_self_blocked) > ret = BLK_STS_DEV_RESOURCE; What if scsi_unblock_requests() is just called after the above check and before returning to block layer core? Then this request is invisible to scsi_run_host_queues()<-scsi_unblock_requests(), and io hang happens. Thanks, Ming