mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-12-04 01:36:58 -05:00
scsi: core: Fix race between handling STS_RESOURCE and completion
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/[email protected]
Fixes: 86ff7c2a80 ("blk-mq: introduce BLK_STS_DEV_RESOURCE")
Cc: Hannes Reinecke <[email protected]>
Cc: Sumit Saxena <[email protected]>
Cc: Kashyap Desai <[email protected]>
Cc: Bart Van Assche <[email protected]>
Cc: Ewan Milne <[email protected]>
Cc: Long Li <[email protected]>
Reported-by: John Garry <[email protected]>
Tested-by: "chenxiang (M)" <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Signed-off-by: Yu Kuai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
85fe8623f0
commit
0b0088e475
1 changed files with 1 additions and 2 deletions
|
|
@ -1719,8 +1719,7 @@ out_put_budget:
|
|||
case BLK_STS_OK:
|
||||
break;
|
||||
case BLK_STS_RESOURCE:
|
||||
if (atomic_read(&sdev->device_busy) ||
|
||||
scsi_device_blocked(sdev))
|
||||
if (scsi_device_blocked(sdev))
|
||||
ret = BLK_STS_DEV_RESOURCE;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in a new issue