scsi-mq: fix requests that use a separate CDB buffer
authorTony Battersby <tonyb@cybernetics.com>
Fri, 22 Aug 2014 19:53:39 +0000 (15:53 -0400)
committerJens Axboe <axboe@fb.com>
Fri, 3 Apr 2015 01:34:54 +0000 (19:34 -0600)
commitfdfd40455d621a43858afaf9d72f5775f66a0fcc
treed9931bc90d7522c7b4d8e9a48010d8cd5a0f8291
parentc8910683a525b79ff0c85e5a87acb542a6aaeb45
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>
block/blk-core.c
block/blk-mq.c
drivers/scsi/scsi_lib.c