From 47b7da25aa54d44737c25e518b185f1123cba503 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 9 Oct 2017 18:15:00 +0000 Subject: [PATCH] scst: Fix SCSI pass-through for kernel version v4.11 and later See also trunk r7153. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7249 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 8bf237ef1..04e39b4a7 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7866,6 +7866,10 @@ static struct request *blk_make_request(struct request_queue *q, scsi_req_init(scsi_req(rq)); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) scsi_req_init(rq); +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + rq->cmd_flags = bio_data_dir(bio) == READ ? REQ_OP_SCSI_IN : + REQ_OP_SCSI_OUT; #else blk_rq_set_block_pc(rq); #endif @@ -8042,6 +8046,9 @@ static struct request *__blk_map_kern_sg(struct request_queue *q, */ rq->cmd_type = REQ_TYPE_BLOCK_PC; #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + rq->cmd_flags = reading ? REQ_OP_SCSI_IN : REQ_OP_SCSI_OUT; +#endif if (bw != NULL) { atomic_set(&bw->bios_inflight, bios); @@ -8095,8 +8102,11 @@ static struct request *blk_map_kern_sg(struct request_queue *q, scsi_req_init(scsi_req(rq)); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) scsi_req_init(rq); +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + rq->cmd_flags = reading ? REQ_OP_SCSI_IN : REQ_OP_SCSI_OUT; #else - rq->cmd_type = REQ_TYPE_BLOCK_PC; + blk_rq_set_block_pc(rq); #endif goto out; }