Skip to content
Snippets Groups Projects
Commit e5eb7048 authored by Ming Lei's avatar Ming Lei Committed by Yongqiang Liu
Browse files

scsi: core: Fix race between handling STS_RESOURCE and completion

mainline inclusion
from mainline-v5.10
commit 673235f9
category: bugfix
bugzilla: 187359, https://gitee.com/openeuler/kernel/issues/I5JQFO
CVE: NA

--------------------------------

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-mi...
parent e9c08f10
No related branches found
No related tags found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment