From patchwork Wed Nov 4 16:48:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 7552151 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 10DE59F399 for ; Wed, 4 Nov 2015 16:48:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 347D02071C for ; Wed, 4 Nov 2015 16:48:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D952E20717 for ; Wed, 4 Nov 2015 16:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030696AbbKDQsa (ORCPT ); Wed, 4 Nov 2015 11:48:30 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:38473 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030498AbbKDQs3 convert rfc822-to-8bit (ORCPT ); Wed, 4 Nov 2015 11:48:29 -0500 Received: by wmeg8 with SMTP id g8so46521342wme.1 for ; Wed, 04 Nov 2015 08:48:28 -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=oWQRc30i14r+26cgUe3uIk90DranrIJumbV93zfmm60=; b=wRi2Oa5bpbq8BPuwMSOC6ZI+V8Da8O1sBYGrGein82ecQM61b27QTuVPP7JYMfhIC4 SWnzTiuWJdizz1myyYu0QRs/V6/skKbDQBf7nM9vwIAxk4Lk+jZKyeJXHumDh2yYAY6y sH0WjPSeE1pVNfDhTQxHqAPr26YdzOwbg0arGoborjLrZDCK4gw0yNnMLCRckclDs456 NCdgYU08Ui5l4bR+tXZrkD3KheHJDCw5BlV5PK/Ymlgw1IUXtC1kOBs1iaFLJKcKRmdK +NvDVXNWB6njkl+4IgMNVaILBY1H0AV1HuxQbV4HyCGdZrUA5vE2gDgsk3ebVRImTR2c A+pA== 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=oWQRc30i14r+26cgUe3uIk90DranrIJumbV93zfmm60=; b=hWLxmzL1e+MQW06wh9du4vvy5hUD4shceRCban7vzrbbkqLSzgZSo7HjqU7aZnHFCo kB+cTSwRzmR60+CjeBKLTUHvkNdp+5cT7RxcRxEavKQYh6ysv0limgk5RmcMcUIRoaaW qHtVIJOgIGbLQGCO8RQmtxH+C+2VJx79hAAoKCaEQqM+4VcsasjythkljOWfP65k1ONL 9nGSTqqJ3AyM9RSPiogEHIZyjEOVNwWBMEIIXG0qg2gQ0UVrOs8p+iVPgE6l1aOhmLio vcndLpEDShO7qnTmuxS+iJ2w3zKZdjS5wJuQvZEd6ooRuMpAyDXG01HxeLCcDlcNlzB0 PBeg== X-Gm-Message-State: ALoCoQkLs86ZQAImGnuKT1y1+k8OgUb/Rh+RXzMnMZ3oZ65GskMhFHF1+GsspqSsWhLTscz3iKw0 X-Received: by 10.28.143.21 with SMTP id r21mr4351209wmd.39.1446655708159; Wed, 04 Nov 2015 08:48:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.27.225.15 with HTTP; Wed, 4 Nov 2015 08:48:08 -0800 (PST) From: Jinpu Wang Date: Wed, 4 Nov 2015 17:48:08 +0100 Message-ID: Subject: [PATCH 1/3] isci: isci: remove SCSI host before detaching from SAS transport To: Jej B , linux-scsi@vger.kernel.org, intel-linux-scu@intel.com Cc: hch@lst.de, brood@attotech.com 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 b1fb56b6d98610251253dc4b858df509df08e813 Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Wed, 4 Nov 2015 09:46:05 +0100 Subject: [PATCH 1/3] isci: 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/isci/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c index 0dfcabe..9e0d069 100644 --- a/drivers/scsi/isci/init.c +++ b/drivers/scsi/isci/init.c @@ -272,11 +272,11 @@ static void isci_unregister(struct isci_host *isci_host) if (!isci_host) return; + shost = to_shost(isci_host); + scsi_remove_host(shost); sas_unregister_ha(&isci_host->sas_ha); - shost = to_shost(isci_host); sas_remove_host(shost); - scsi_remove_host(shost); scsi_host_put(shost); }