Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2679277imj; Mon, 11 Feb 2019 06:56:12 -0800 (PST) X-Google-Smtp-Source: AHgI3Iax4PD58nPS32XmW1lMHT9bKZvSQwQfzvr60hiMpBL4r9qi4aPMKdssB8uEtbRknpoHgYqw X-Received: by 2002:a63:2ccd:: with SMTP id s196mr33669084pgs.194.1549896972548; Mon, 11 Feb 2019 06:56:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549896972; cv=none; d=google.com; s=arc-20160816; b=jD3r4Mchy8WQ5aDH7rTXdnYy1hTvpnHAX38L/+bjNPzFrw6ankYh6LVaiZimLdfsYn R1SZ9meZl//B5+wUTxwtxyINBNHIgUc1FEF6sfj2xIosAFNLrS1GrRRmf4DmY/O838Q/ 3/XuiYQLKcuJBjHpQM76zif0cJ4tXEbM0tzrVGmmSJb0d2GeBbpyGMWFqlwguZq1WGuV EmKTFyEwtx6UWpAOESaNee8Y6EBrUF0FCGSeExmu3hxBrrs/ocyKkBsoG5aDBo6/c5D3 XZtRjZP++pZV4gljrXRTmIKkZPb9+9aVvkkEvXcwA4OIedTLoKMo0ga5BfThsqm1xJCF iwMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VFY3w6tFqOG6n/LK9GYQCUzUla1gA8UNfbHnY75izzk=; b=vZy8/jHQHGHPGSBKgGqg8TyOtsXpaWtEh/jgT+3GuHbV4gqoYg8917TjbAoBRDUSB4 AkIwC+LmZ+pD1UDjXAPsaaWxe7s4gUwyB2QkIrKtWTpsb5x+hRXvhP+WuK9XfueIqvfy DiRtOFbgDtsw9tsuTRG+CMj+Q7Lm+1op676BnBzrSBx0LMn4GApuTYDomLK/ttp0+sJ4 NSNv8Ogp824aZ0Piiygp5eiFS1YGboCHyCdvGlWoQR1LyNWjkC/quuWqy6xPN2P8Fmwp Ayp+1F1Kfo/ggeXioinIC6NcZteugqtnkThvWHBoJnDWQpUUo4pr8eT7pHo14NLsvszb ISXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C4T7mxhE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si10443003pgo.166.2019.02.11.06.55.56; Mon, 11 Feb 2019 06:56:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C4T7mxhE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388497AbfBKOy6 (ORCPT + 99 others); Mon, 11 Feb 2019 09:54:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:41828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388723AbfBKOy4 (ORCPT ); Mon, 11 Feb 2019 09:54:56 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D2C71222A1; Mon, 11 Feb 2019 14:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896895; bh=rBIdTQj5pAzzZ6TMm96ch/WxLEXbZ0szKTnhWHkV8qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C4T7mxhEt4cVzB8uFAZmnO1EZEsCuDXzLBqVSP9clt4YnXuNvSGIzFeyoBLDTdqKS STpY9ZDNL2Kuh+zlQRrUtXL43SCLeNuZg5Cn8ozB8ZClX9ncqObDt5EhtdqRU39b2r sajgT12dnhgXsELYTF4yH7C0XaTf130wD5JHAbxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suganath Prabu , Bjorn Helgaas , Andy Shevchenko , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 009/205] scsi: mpt3sas: Call sas_remove_host before removing the target devices Date: Mon, 11 Feb 2019 15:16:47 +0100 Message-Id: <20190211141827.769611518@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit dc730212e8a378763cb182b889f90c8101331332 ] Call sas_remove_host() before removing the target devices in the driver's .remove() callback function(i.e. during driver unload time). So that driver can provide a way to allow SYNC CACHE, START STOP unit commands etc. (which are issued from SML) to the target drives during driver unload time. Once sas_remove_host() is called before removing the target drives then driver can just clean up the resources allocated for target devices and no need to call sas_port_delete_phy(), sas_port_delete() API's as these API's internally called from sas_remove_host(). Signed-off-by: Suganath Prabu Reviewed-by: Bjorn Helgaas Reviewed-by: Andy Shevchenko Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_transport.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index ae5e579ac473..b28efddab7b1 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -8260,6 +8260,7 @@ static void scsih_remove(struct pci_dev *pdev) /* release all the volumes */ _scsih_ir_shutdown(ioc); + sas_remove_host(shost); list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list, list) { if (raid_device->starget) { @@ -8296,7 +8297,6 @@ static void scsih_remove(struct pci_dev *pdev) ioc->sas_hba.num_phys = 0; } - sas_remove_host(shost); mpt3sas_base_detach(ioc); spin_lock(&gioc_lock); list_del(&ioc->list); diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c index 63dd9bc21ff2..66d9f04c4c0b 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_transport.c +++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c @@ -846,10 +846,13 @@ mpt3sas_transport_port_remove(struct MPT3SAS_ADAPTER *ioc, u64 sas_address, mpt3sas_port->remote_identify.sas_address, mpt3sas_phy->phy_id); mpt3sas_phy->phy_belongs_to_port = 0; - sas_port_delete_phy(mpt3sas_port->port, mpt3sas_phy->phy); + if (!ioc->remove_host) + sas_port_delete_phy(mpt3sas_port->port, + mpt3sas_phy->phy); list_del(&mpt3sas_phy->port_siblings); } - sas_port_delete(mpt3sas_port->port); + if (!ioc->remove_host) + sas_port_delete(mpt3sas_port->port); kfree(mpt3sas_port); } -- 2.19.1