From patchwork Thu Nov 5 11:33:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 7560021 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 A82679F36A for ; Thu, 5 Nov 2015 11:33:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C090A2088E for ; Thu, 5 Nov 2015 11:33:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92D712088C for ; Thu, 5 Nov 2015 11:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032029AbbKELdy (ORCPT ); Thu, 5 Nov 2015 06:33:54 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:38599 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031044AbbKELdy (ORCPT ); Thu, 5 Nov 2015 06:33:54 -0500 Received: by wmeg8 with SMTP id g8so10658167wme.1 for ; Thu, 05 Nov 2015 03:33:53 -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=EzcmZYiFekokn3TZJannV/vEEwU9IiPI6Wt9mvwDQnE=; b=sWxq7egjk3aDy3BmdvRfPA6ecYCJxCgvXQDpbyZlPYo0RK/PgvN7CObry/htet73dC gVH1QaEVRLUUlX74swxwwSn6efvTqaTkpTPL5SpztBHp6qjpQ043qaRYiNDf3iVfCBDI hJmHOivg1z9cnAadeozyCszh5CKPhA+d97nwf1LIpqx2Sq2xfNXGAQqeruZei945NXfy 9+YlPd3X2C3tCnzHZygTb1FupxHnpUiV5sdvmZqALWQgABPdctnCP1RzoHGZLQOYUsdM R2RkpUoGS5PhSmfGEOjNpysdwOGWpmZ0sl2R7ScJoSYqr0DX22OMTzYAe9B2DnHZubkY STHw== 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=EzcmZYiFekokn3TZJannV/vEEwU9IiPI6Wt9mvwDQnE=; b=VseQdJ3XdbhyirSMexlbQLqM1Z+NzSbc398kf8mX/MWoCnvJNGQXtXMmOpfX8e9B3s lUmHuBYb0CGgr6bNNSycBPpdJPz1Rjq0P7IVzkQ+NhOhDOObi6OEKzOSWoHeyDd9Tcil 1WOF7QrYXPCi0cWchCpaALbIiVXy9lwu3RLaQe14OYudYNWDfZnUW6ldIY7XKifovMFr yNYva71qnIuiei2+Tm70r8Bjy5kxU1zPcC0H6RDDURjfFxS4OO/vBcMptXfrjqDoG5dc 0IX1YDBmvfEic9SM8pCfjt/Ih+ESBNDV5tsakcHFr/LFQSpygkSA6twSouNfAb4k7p6G 2cWA== X-Gm-Message-State: ALoCoQnObmJKJR5i7KxQzEL62URFFNJ2sbxP3/F500j1JFmnqH/soTvtapwUckI2B8HYTF26Krlt X-Received: by 10.28.87.15 with SMTP id l15mr3185142wmb.66.1446723233173; Thu, 05 Nov 2015 03:33:53 -0800 (PST) Received: from jinpu-GA-870A-USB3.pb.local ([62.217.45.26]) by smtp.gmail.com with ESMTPSA id r65sm33655983wmb.20.2015.11.05.03.33.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 03:33:52 -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 2/3] aic94xx: remove SCSI host before detaching from SAS transport Date: Thu, 5 Nov 2015 12:33:45 +0100 Message-Id: <1446723225-9704-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/aic94xx/aic94xx_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index f6c336b..4b56976 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c @@ -704,10 +704,10 @@ static int asd_unregister_sas_ha(struct asd_ha_struct *asd_ha) { int err; + scsi_remove_host(asd_ha->sas_ha.core.shost); err = sas_unregister_ha(&asd_ha->sas_ha); sas_remove_host(asd_ha->sas_ha.core.shost); - scsi_remove_host(asd_ha->sas_ha.core.shost); scsi_host_put(asd_ha->sas_ha.core.shost); kfree(asd_ha->sas_ha.sas_phy);