From patchwork Wed Nov 4 16:52:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 7552171 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 C3B1C9F399 for ; Wed, 4 Nov 2015 16:53:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C506B20460 for ; Wed, 4 Nov 2015 16:53:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D3F4420383 for ; Wed, 4 Nov 2015 16:53:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030771AbbKDQxA (ORCPT ); Wed, 4 Nov 2015 11:53:00 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:38479 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030567AbbKDQw6 convert rfc822-to-8bit (ORCPT ); Wed, 4 Nov 2015 11:52:58 -0500 Received: by wmeg8 with SMTP id g8so46632502wme.1 for ; Wed, 04 Nov 2015 08:52:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks_com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=67qqpv8deV4HnXfjLRvtVMSQ3DUm6OjuVTJQvEl3P58=; b=eHgHKGZtciGVxlRI8zIx7Cvhr2RW9N5J2ECRP6ddcyAMAIx3fSuZkYI2roBAm8a8JD 3tcax/NA9ykFvqwfpxnPP5K1uPpbUNgDXU0HoIyEAL18NPYUBG0lpAzFrvjCCrLFue2l IPsgKZKauV8ZorKf7JstlBolLUo5UcZIgcWDr/jbfThIIybLwq1unJSmZVsC1eZgM/7l BRKNr25/OqPVtH9odnbELclMqk8fGBzHUC11EZiqqL5s24suo1/3/Gk1Nb7cYpxd7U7z tIJXEtVVVu8+f5toJGNBDjeRJRdnnNPXSGPnDt2Sj7gRkwA/Jw1IcmhgiW1krcxCbxJw dRIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=67qqpv8deV4HnXfjLRvtVMSQ3DUm6OjuVTJQvEl3P58=; b=MSSqLEV0/ACExRvOVrKo3L8/xzfkj5Kro5zOtkGJatHbMnB+OIG1SYcyYwcZ2mnqZp TVJFeepj4+r+CrFLTI9q3q0iT2rY/Y+Y9/x6/ha5d51oYK/HcIcgwNJHuCNPjW/wB9XN TBd2Fr6K6wxTP62Xy62v/MhE+3uEyjDwWLJh3wtxHinxkSEdwfbHnIGCqCuV4C4VwFaO rGnaMoyHrTAn9y1r7olIP6G8j+xpGxYKtW1MX4k4qTaUPitJfQN7R8BawU5RgN3R9TdY IcuAdrP4ZUne43oUnUCeGDAnKOjSZkGJtChPMU6vDzvkCauTxC4U0O4/Q5O4thuZ/Jme Yn/g== X-Gm-Message-State: ALoCoQkcKaaHRFoncOnVg0pfkr7RAoI2qR0rlsPuzAg/G5XHsZlM8s4NaQKX//FO8o8Z0+JEMeTE X-Received: by 10.28.146.133 with SMTP id u127mr5041444wmd.94.1446655977293; Wed, 04 Nov 2015 08:52:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.27.225.15 with HTTP; Wed, 4 Nov 2015 08:52:37 -0800 (PST) From: Jinpu Wang Date: Wed, 4 Nov 2015 17:52:37 +0100 Message-ID: Subject: [PATCH 3/3] mvsas: remove SCSI host before detaching from SAS transport To: Jej B , linux-scsi@vger.kernel.org Cc: hch , brood 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 From 6c3cb7d4df1e164008338c922cd99149a6a8191b Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Wed, 4 Nov 2015 10:05:01 +0100 Subject: [PATCH 3/3] mvsas: remove SCSI host before detaching from SAS transport 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 --- 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);