A later patch will add a call to a request initialization function
into blk_rq_init(). Hence make sure that all blk_rq_init() calls
specify the request queue pointer. Since TMF callback functions in
SCSI LLD drivers do not use request.q, this patch does not change
the behavior of any SCSI driver.

Signed-off-by: Bart Van Assche <bart.vanass...@sandisk.com>
Reviewed-by: Christoph Hellwig <h...@lst.de>
Reviewed-by: Hannes Reinecke <h...@suse.com>
Cc: Martin K. Petersen <martin.peter...@oracle.com>
Cc: James Bottomley <james.bottom...@hansenpartnership.com>
---
 drivers/scsi/scsi_error.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index ecc07dab893d..97d5a0bb7061 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2274,7 +2274,12 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user 
*arg)
                        shost->hostt->cmd_size, GFP_KERNEL);
        if (!rq)
                goto out_put_autopm_host;
-       blk_rq_init(NULL, rq);
+       /*
+        * Although blk_rq_init() is intended for single queue block
+        * drivers, this code path even uses blk_rq_init() when @dev is
+        * a scsi-mq device.
+        */
+       blk_rq_init(dev->request_queue, rq);
 
        scmd = (struct scsi_cmnd *)(rq + 1);
        scsi_init_command(dev, scmd);
-- 
2.12.2

Reply via email to