From patchwork Thu Nov 5 11:34:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 7560031 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CBD749F36A for ; Thu, 5 Nov 2015 11:34:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA45D2088C for ; Thu, 5 Nov 2015 11:34:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC2F82088B for ; Thu, 5 Nov 2015 11:34:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031176AbbKELe1 (ORCPT ); Thu, 5 Nov 2015 06:34:27 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:33339 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031023AbbKELe0 (ORCPT ); Thu, 5 Nov 2015 06:34:26 -0500 Received: by wmeg8 with SMTP id g8so11531991wme.0 for ; Thu, 05 Nov 2015 03:34:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=YSxMQFkwPzUAixo5qotsUAaAbA6GiugfAf+mULbuWdg=; b=nOzeLfdpv4iP6/XBhR1aquejlmJ34SXra+0/PO/pGfG0qzZI4ifMWZaGR7fqS7T0FP u3SwimwJ0u3CUkQswF91ubX7o5wu1CRRiG6r7e2QsDT+sVwS5RvxAciNGsZnTJwMj5Ff jZn12iq8U24lAD7WBE773g4X20BSubyTEgrixxdkk62tVibV5r/Fo+yTib/W/QHqCWwi zLttK1wUSM6vMR2p7sDArz9hh8/S7qJG2L+SAatDoTwrTWDOshQ/MYyZB7+vE2YGMd/J hNWshh/1L5EbW6e16INX129an2JRBubkfLV6kkMc9FKPwD3lmHZIgVL3HJ1oGEQRUjjE c5IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YSxMQFkwPzUAixo5qotsUAaAbA6GiugfAf+mULbuWdg=; b=TH/BTHDhjDuQm01BxuhQBxdWRaRi4XabOMzZ7sKHQaC2YXW9TJkUs9jr235QFOpWQl czm2TceQpt9ksQBvVVyMpJ+H9xqd3yf4P4FaiQfM2VTCiEoRpzJbE2+tK0X2Lu1kidnV awePZSUQ9iAEaAryvnu5MNt1nkQCEuirK65NMDWOkfMt7In7SmYh57T4K8qr05eKcM3r C1PjRzg/sfa5B9isCf4L1nUrQTwV1Jeszp85L8G9BxnZjKwKe2C5dq1PpA2Gp3BfDuMw 5zom3CSaT6rNz4g0At0rrygCcokp+0+2RiUcp/tP83PiI19iL7WAouYgu0l1TCkWT6XD sQNA== X-Gm-Message-State: ALoCoQmOQe8dY20alO2GyY7lkh0R89hT39tps8wP19833mCu3o7mLKhyRZ105Ri/0goWtYkijFOw X-Received: by 10.28.144.138 with SMTP id s132mr2828739wmd.97.1446723265423; Thu, 05 Nov 2015 03:34:25 -0800 (PST) Received: from jinpu-GA-870A-USB3.pb.local ([62.217.45.26]) by smtp.gmail.com with ESMTPSA id lb2sm6527332wjc.15.2015.11.05.03.34.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 03:34:24 -0800 (PST) From: Jack Wang To: linux-scsi@vger.kernel.org, James.Bottomley@hansenpartnership.com Cc: hch@lst.de, brood@attotech.com, Jack Wang Subject: [PATCH 3/3] mvsas: remove SCSI host before detaching from SAS transport Date: Thu, 5 Nov 2015 12:34:18 +0100 Message-Id: <1446723258-9751-1-git-send-email-jinpu.wang@profitbricks.com> X-Mailer: git-send-email 1.9.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP commit cff549e4860f ("scsi: proper state checking and module refcount handling in scsi_device_get") the reference count of scsi device was changed, which could lead to when rmmod with at least on drive attached, SCSI error handle will run into infinite loop, and lockup the system. Fix it by remove scsi host first, this way scsi core will not send commands down after detaching SAS transport. This is a follow up fix for Benjamin's fix for pm80xx. See also: http://www.spinics.net/lists/linux-scsi/msg90088.html Signed-off-by: Jack Wang Reviewed-by: Christoph Hellwig --- drivers/scsi/mvsas/mv_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c index e2d555c..1960d95 100644 --- a/drivers/scsi/mvsas/mv_init.c +++ b/drivers/scsi/mvsas/mv_init.c @@ -641,9 +641,9 @@ static void mvs_pci_remove(struct pci_dev *pdev) tasklet_kill(&((struct mvs_prv_info *)sha->lldd_ha)->mv_tasklet); #endif + scsi_remove_host(mvi->shost); sas_unregister_ha(sha); sas_remove_host(mvi->shost); - scsi_remove_host(mvi->shost); MVS_CHIP_DISP->interrupt_disable(mvi); free_irq(mvi->pdev->irq, sha);