aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorTony Battersby <tonyb@cybernetics.com>2014-08-22 15:53:39 -0400
committerJens Axboe <axboe@fb.com>2014-08-22 16:04:31 -0400
commit6f4a16266fb3e58cd3e200eab51d2220ef92d604 (patch)
treeefab6520c3793325ef2881f7fbe2e34df75f2204 /block
parenta57821cac6bb6e46abea118e34d0e86444ec1410 (diff)
scsi-mq: fix requests that use a separate CDB buffer
This patch fixes code such as the following with scsi-mq enabled: rq = blk_get_request(...); blk_rq_set_block_pc(rq); rq->cmd = my_cmd_buffer; /* separate CDB buffer */ blk_execute_rq_nowait(...); Code like this appears in e.g. sg_start_req() in drivers/scsi/sg.c (for large CDBs only). Without this patch, scsi_mq_prep_fn() will set rq->cmd back to rq->__cmd, causing the wrong CDB to be sent to the device. Signed-off-by: Tony Battersby <tonyb@cybernetics.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c1
-rw-r--r--block/blk-mq.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index c359d72e9d76..bf930f481d43 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1252,7 +1252,6 @@ void blk_rq_set_block_pc(struct request *rq)
1252 rq->__sector = (sector_t) -1; 1252 rq->__sector = (sector_t) -1;
1253 rq->bio = rq->biotail = NULL; 1253 rq->bio = rq->biotail = NULL;
1254 memset(rq->__cmd, 0, sizeof(rq->__cmd)); 1254 memset(rq->__cmd, 0, sizeof(rq->__cmd));
1255 rq->cmd = rq->__cmd;
1256} 1255}
1257EXPORT_SYMBOL(blk_rq_set_block_pc); 1256EXPORT_SYMBOL(blk_rq_set_block_pc);
1258 1257
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 7950f8d7c1bb..4aac82615a46 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -176,6 +176,8 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx,
176 /* tag was already set */ 176 /* tag was already set */
177 rq->errors = 0; 177 rq->errors = 0;
178 178
179 rq->cmd = rq->__cmd;
180
179 rq->extra_len = 0; 181 rq->extra_len = 0;
180 rq->sense_len = 0; 182 rq->sense_len = 0;
181 rq->resid_len = 0; 183 rq->resid_len = 0;