lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1666693096-180008-20-git-send-email-john.garry@huawei.com>
Date:   Tue, 25 Oct 2022 18:18:13 +0800
From:   John Garry <john.garry@...wei.com>
To:     <axboe@...nel.dk>, <damien.lemoal@...nsource.wdc.com>,
        <jejb@...ux.ibm.com>, <martin.petersen@...cle.com>,
        <jinpu.wang@...ud.ionos.com>, <hare@...e.de>, <bvanassche@....org>,
        <hch@....de>, <ming.lei@...hat.com>, <niklas.cassel@....com>
CC:     <linux-block@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-ide@...r.kernel.org>, <linux-scsi@...r.kernel.org>,
        <linuxarm@...wei.com>, John Garry <john.garry@...wei.com>
Subject: [PATCH RFC v3 19/22] scsi: libsas: Queue TMF commands as requests

Like what we did with SMP commands, send TMF commands through the block
layer.

In sas_task_abort() we must ensure to not confuse "TMF" for SATA with
regular SATA command which comes from libata.

Signed-off-by: John Garry <john.garry@...wei.com>
---
 drivers/scsi/libsas/sas_scsi_host.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 2c734a87bb7c..e6ee8dd56a45 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -1067,13 +1067,17 @@ int sas_execute_tmf(struct domain_device *device, void *parameter,
 	int res, retry;
 
 	for (retry = 0; retry < TASK_RETRY; retry++) {
-		task = sas_alloc_slow_task(GFP_KERNEL);
+		struct request *rq;
+
+		task = sas_alloc_slow_task_rq(device, GFP_KERNEL);
 		if (!task)
 			return -ENOMEM;
 
-		task->dev = device;
 		task->task_proto = device->tproto;
 
+		rq = scsi_cmd_to_rq(task->uldd_task);
+		rq->timeout = TASK_TIMEOUT;
+
 		if (dev_is_sata(device)) {
 			task->ata_task.device_control_reg_update = 1;
 			if (force_phy_id >= 0) {
@@ -1085,20 +1089,9 @@ int sas_execute_tmf(struct domain_device *device, void *parameter,
 			memcpy(&task->ssp_task, parameter, para_len);
 		}
 
-		task->task_done = sas_task_internal_done;
 		task->tmf = tmf;
 
-		task->slow_task->timer.function = sas_task_internal_timedout;
-		task->slow_task->timer.expires = jiffies + TASK_TIMEOUT;
-		add_timer(&task->slow_task->timer);
-
-		res = i->dft->lldd_execute_task(task, GFP_KERNEL);
-		if (res) {
-			del_timer_sync(&task->slow_task->timer);
-			pr_err("executing TMF task failed %016llx (%d)\n",
-			       SAS_ADDR(device->sas_addr), res);
-			break;
-		}
+		blk_execute_rq_nowait(rq, true);
 
 		wait_for_completion(&task->slow_task->completion);
 
@@ -1270,7 +1263,7 @@ void sas_task_abort(struct sas_task *task)
 		return;
 	}
 
-	if (dev_is_sata(task->dev))
+	if (dev_is_sata(task->dev) && !task->slow_task)
 		sas_ata_task_abort(task);
 	else
 		blk_abort_request(scsi_cmd_to_rq(sc));
-- 
2.35.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ