Skip to content

Commit

Permalink
scsi: ufs-bsg: Wake the device before sending raw upiu commands
Browse files Browse the repository at this point in the history
The scsi async probe process is calling blk_pm_runtime_init for each lun,
and then those request queues are monitored by the block layer pm
engine (blk-pm.c).  This is however, not the case for scsi-passthrough
queues, created by bsg_setup_queue().

So the ufs-bsg driver might send various commands, disregarding the pm
status of the device. This is wrong, regardless if its request queue is
pm-aware or not.

Fixes: df032bf (scsi: ufs: Add a bsg endpoint that supports UPIUs)
Link: https://lore.kernel.org/r/1570696267-8487-1-git-send-email-avri.altman@wdc.com
Reported-by: Yuliy Izrailov <yuliy.izrailov@wdc.com>
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Avri Altman authored and Martin K. Petersen committed Oct 18, 2019
1 parent 535fb49 commit 74e5e46
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/scsi/ufs/ufs_bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ static int ufs_bsg_request(struct bsg_job *job)

bsg_reply->reply_payload_rcv_len = 0;

pm_runtime_get_sync(hba->dev);

msgcode = bsg_request->msgcode;
switch (msgcode) {
case UPIU_TRANSACTION_QUERY_REQ:
Expand Down Expand Up @@ -135,6 +137,8 @@ static int ufs_bsg_request(struct bsg_job *job)
break;
}

pm_runtime_put_sync(hba->dev);

if (!desc_buff)
goto out;

Expand Down

0 comments on commit 74e5e46

Please sign in to comment.