Message ID | 20200906012219.17893-6-bvanassche@acm.org |
---|---|
State | New |
Headers | show |
Series | Rework runtime suspend and SCSI domain validation | expand |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index b197291c631a..f7604d930e3c 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1979,7 +1979,8 @@ static void scsi_eh_lock_door(struct scsi_device *sdev) struct request *req; struct scsi_request *rq; - req = blk_get_request(sdev->request_queue, REQ_OP_SCSI_IN, 0); + req = blk_get_request(sdev->request_queue, REQ_OP_SCSI_IN, + BLK_MQ_REQ_NOWAIT); if (IS_ERR(req)) return; rq = scsi_req(req);
It is not guaranteed that a request is available when scsi_eh_lock_door() is called. Hence pass the BLK_MQ_REQ_NOWAIT flag to blk_get_request(). This patch has a second purpose, namely preventing that scsi_eh_lock_door() deadlocks if sdev->request_queue is frozen and if a SCSI command is submitted to a SCSI device through a second request queue that has not been frozen. Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Can Guo <cang@codeaurora.org> Cc: Stanley Chu <stanley.chu@mediatek.com> Cc: Ming Lei <ming.lei@redhat.com> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/scsi/scsi_error.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)