From patchwork Tue Sep 6 15:36:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 75551 Delivered-To: patch@linaro.org Received: by 10.140.106.11 with SMTP id d11csp609100qgf; Tue, 6 Sep 2016 08:30:45 -0700 (PDT) X-Received: by 10.66.235.100 with SMTP id ul4mr73672997pac.50.1473175845389; Tue, 06 Sep 2016 08:30:45 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gm2si35860734pac.159.2016.09.06.08.30.45 for ; Tue, 06 Sep 2016 08:30:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934219AbcIFPan (ORCPT ); Tue, 6 Sep 2016 11:30:43 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:47500 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935768AbcIFPXx (ORCPT ); Tue, 6 Sep 2016 11:23:53 -0400 Received: from 172.24.1.47 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.47]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CHK54718; Tue, 06 Sep 2016 23:23:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.235.1; Tue, 6 Sep 2016 23:23:40 +0800 From: John Garry To: , CC: , , , , , , John Garry , "Xiang Chen" Subject: [PATCH 08/15] hisi_sas: fix a potential warning for sata disk ejection Date: Tue, 6 Sep 2016 23:36:18 +0800 Message-ID: <1473176185-217808-9-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473176185-217808-1-git-send-email-john.garry@huawei.com> References: <1473176185-217808-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.57CEDF86.0415, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: b7b7002216e7cef71b49bb61de459896 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If hisi_sas_task_prep() fails for a SATA device due to PHY down, we return a failure to libata and also call task_done(), which will cause ata_qc_complete() to be called twice: - first call from hisi_sas_task_prep(), which will clear flag ATA_QCFLAG_ACTIVE - ata_qc_complete() called from libata The warning call trace is as follows: [ 117.070206] [] __ata_qc_complete+0xf4/0x11c [ 117.070208] [] ata_qc_complete+0x180/0x200 [ 117.070210] [] ata_qc_issue+0x110/0x354 [ 117.070212] [] ata_exec_internal_sg+0x240/0x4d0 [ 117.070214] [] ata_exec_internal+0x60/0xa0 [ 117.070217] [] ata_read_log_page+0x188/0x1b4 [ 117.070218] [] ata_eh_analyze_ncq_error+0xa8/0x274 [ 117.070220] [] ata_eh_link_autopsy+0x94/0x8c8 [ 117.070222] [] ata_eh_autopsy+0x34/0xe8 [ 117.070223] [] ata_do_eh+0x28/0xc0 [ 117.070225] [] ata_std_error_handler+0x3c/0x84 [ 117.070227] [] ata_scsi_port_error_handler+0x480/0x674 [ 117.070230] [] async_sas_ata_eh+0x44/0x78 [ 117.070231] [] async_run_entry_fn+0x40/0x104 [ 117.070234] [] process_one_work+0x128/0x2f0 [ 117.070235] [] worker_thread+0x58/0x434 [ 117.070237] [] kthread+0xd4/0xe8 [ 117.070240] [] ret_from_fork+0x10/0x40 The issue is resolved by simply returning a failure status code to the upper layer. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index dcb17a3..d58e223 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -205,26 +205,12 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba, } port = device->port->lldd_port; if (port && !port->port_attached) { - if (sas_protocol_ata(task->task_proto)) { - struct task_status_struct *ts = &task->task_status; - - dev_info(dev, - "task prep: SATA/STP port%d not attach device\n", - device->port->id); - ts->resp = SAS_TASK_COMPLETE; - ts->stat = SAS_PHY_DOWN; - task->task_done(task); - } else { - struct task_status_struct *ts = &task->task_status; - - dev_info(dev, - "task prep: SAS port%d does not attach device\n", - device->port->id); - ts->resp = SAS_TASK_UNDELIVERED; - ts->stat = SAS_PHY_DOWN; - task->task_done(task); - } - return 0; + dev_info(dev, "task prep: %s port%d not attach device\n", + (sas_protocol_ata(task->task_proto)) ? + "SATA/STP" : "SAS", + device->port->id); + + return SAS_PHY_DOWN; } if (!sas_protocol_ata(task->task_proto)) {