Skip to content

Commit ef2b7eb

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "One core change that moves a disk start message to a location where it will only be printed once instead of twice plus a couple of error handling race fixes in the ufs driver" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: sd: Do not repeat the starting disk message scsi: ufs: core: Fix ufshcd_abort_one racing issue scsi: ufs: core: Fix ufshcd_clear_cmd racing issue
2 parents d6e1712 + 7a6bbc2 commit ef2b7eb

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

drivers/scsi/sd.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4119,8 +4119,6 @@ static int sd_resume(struct device *dev)
41194119
{
41204120
struct scsi_disk *sdkp = dev_get_drvdata(dev);
41214121

4122-
sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
4123-
41244122
if (opal_unlock_from_suspend(sdkp->opal_dev)) {
41254123
sd_printk(KERN_NOTICE, sdkp, "OPAL unlock failed\n");
41264124
return -EIO;
@@ -4137,12 +4135,13 @@ static int sd_resume_common(struct device *dev, bool runtime)
41374135
if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */
41384136
return 0;
41394137

4138+
sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
4139+
41404140
if (!sd_do_start_stop(sdkp->device, runtime)) {
41414141
sdkp->suspended = false;
41424142
return 0;
41434143
}
41444144

4145-
sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
41464145
ret = sd_start_stop_device(sdkp, 1);
41474146
if (!ret) {
41484147
sd_resume(dev);

drivers/ufs/core/ufs-mcq.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,15 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac);
105105
* @hba: per adapter instance
106106
* @req: pointer to the request to be issued
107107
*
108-
* Return: the hardware queue instance on which the request would
109-
* be queued.
108+
* Return: the hardware queue instance on which the request will be or has
109+
* been queued. %NULL if the request has already been freed.
110110
*/
111111
struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
112112
struct request *req)
113113
{
114-
u32 utag = blk_mq_unique_tag(req);
115-
u32 hwq = blk_mq_unique_tag_to_hwq(utag);
114+
struct blk_mq_hw_ctx *hctx = READ_ONCE(req->mq_hctx);
116115

117-
return &hba->uhq[hwq];
116+
return hctx ? &hba->uhq[hctx->queue_num] : NULL;
118117
}
119118

120119
/**
@@ -515,6 +514,8 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba, int task_tag)
515514
if (!cmd)
516515
return -EINVAL;
517516
hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd));
517+
if (!hwq)
518+
return 0;
518519
} else {
519520
hwq = hba->dev_cmd_queue;
520521
}

drivers/ufs/core/ufshcd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6456,6 +6456,8 @@ static bool ufshcd_abort_one(struct request *rq, void *priv)
64566456
/* Release cmd in MCQ mode if abort succeeds */
64576457
if (is_mcq_enabled(hba) && (*ret == 0)) {
64586458
hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(lrbp->cmd));
6459+
if (!hwq)
6460+
return 0;
64596461
spin_lock_irqsave(&hwq->cq_lock, flags);
64606462
if (ufshcd_cmd_inflight(lrbp->cmd))
64616463
ufshcd_release_scsi_cmd(hba, lrbp);

0 commit comments

Comments
 (0)