tcm/pscsi: Fix incorrect usage of head_of_queue with blk_execute_rq_nowait()
Subsystems (2)
PATCH 1/3 tcm/pscsi: Fix incorrect usage of head_of_queue with blk_execute_rq_nowait()
From: Nicholas Bellinger <[email protected]>
This patch adds a conditional check based on the received struct se_task->task_se_cmd->sam_task_attr to determine if the HEAD_OF_QUEUE flag should be set when calling blk_execute_rq_nowait(). This fixes a bug where all struct request for TCM/pSCSI where being set with the HEAD_OF_QUEUE tag.
Many thanks to Boaz Harrosh for catching this one!
Reported-by Boaz Harrosh <[email protected]>
Signed-off-by Nicholas A. Bellinger <[email protected]>
--- drivers/target/target_core_pscsi.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/target/target_core_pscsi.c +6 -2
@@ -41,6 +41,7 @@#include <scsi/scsi_device.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_host.h> +#include <scsi/libsas.h> /* For TASK_ATTR_* */ #include <target/target_core_base.h> #include <target/target_core_device.h>
@@ -802,9 +803,12 @@ static int pscsi_do_task(struct se_task *task) pt->pscsi_req->retries =PS_RETRY ;/* * Queue the struct request into the struct scsi_device->request_queue. +* Also check for HEAD_OF_QUEUE SAM TASK attr from received se_cmd +* descriptor */ -blk_execute_rq_nowait (pdv->pdv_sd->request_queue,NULL , - pt->pscsi_req,1 , pscsi_req_done); +blk_execute_rq_nowait (pdv->pdv_sd->request_queue,NULL , pt->pscsi_req, + (task->task_se_cmd->sam_task_attr ==TASK_ATTR_HOQ ), + pscsi_req_done);return PYX_TRANSPORT_SENT_TO_TRANSPORT ; }
Signature · 1 line
1.5.6.5