Re: [PATCH stable 5.4] scsi: core: Fix race between handling STS_RESOURCE and completion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 01, 2022 at 09:22:51AM +0800, Yu Kuai wrote:
> From: Ming Lei <ming.lei@xxxxxxxxxx>
> 
> commit 673235f915318ced5d7ec4b2bfd8cb909e6a4a55 upstream.
> 
> When queuing I/O request to LLD, STS_RESOURCE may be returned because:
> 
>  - Host is in recovery or blocked
> 
>  - Target queue throttling or target is blocked
> 
>  - LLD rejection
> 
> In these scenarios BLK_STS_DEV_RESOURCE is returned to the block layer to
> avoid an unnecessary re-run of the queue. However, all of the requests
> queued to this SCSI device may complete immediately after reading
> 'sdev->device_busy' and BLK_STS_DEV_RESOURCE is returned to block layer. In
> that case the current I/O won't get a chance to get queued since it is
> invisible at that time for both scsi_run_queue_async() and blk-mq's
> RESTART.
> 
> Fix the issue by not returning BLK_STS_DEV_RESOURCE in this situation.
> 
> Link: https://lore.kernel.org/r/20201202100419.525144-1-ming.lei@xxxxxxxxxx
> Fixes: 86ff7c2a80cd ("blk-mq: introduce BLK_STS_DEV_RESOURCE")
> Cc: Hannes Reinecke <hare@xxxxxxxx>
> Cc: Sumit Saxena <sumit.saxena@xxxxxxxxxxxx>
> Cc: Kashyap Desai <kashyap.desai@xxxxxxxxxxxx>
> Cc: Bart Van Assche <bvanassche@xxxxxxx>
> Cc: Ewan Milne <emilne@xxxxxxxxxx>
> Cc: Long Li <longli@xxxxxxxxxxxxx>
> Reported-by: John Garry <john.garry@xxxxxxxxxx>
> Tested-by: "chenxiang (M)" <chenxiang66@xxxxxxxxxxxxx>
> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
> Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
> ---
>  drivers/scsi/scsi_lib.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Both now queued up, thanks.

greg k-h



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux