From patchwork Wed Nov 4 16:51:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 7552161 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 113DB9F399 for ; Wed, 4 Nov 2015 16:51:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 21B5B20738 for ; Wed, 4 Nov 2015 16:51:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2ACBD20729 for ; Wed, 4 Nov 2015 16:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754857AbbKDQvY (ORCPT ); Wed, 4 Nov 2015 11:51:24 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:33251 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752679AbbKDQvX convert rfc822-to-8bit (ORCPT ); Wed, 4 Nov 2015 11:51:23 -0500 Received: by wmeg8 with SMTP id g8so115681207wme.0 for ; Wed, 04 Nov 2015 08:51:22 -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=Lu5qYuB+tjK8/mDIQYFynpxQAVOnxA6nuELbsLi9pQ0=; b=icGVn6ntk1ArqNHIfVfbbTzg5DF9W2kXk/9enyRH7n9SMcFdaLm3WAKKMNomMvA1S+ t6e1i5y87fyUJ3d4/itdusSCP4uSLKcZB9B1AMFyTMWd2yGQYOM5ZBv9VZfY2hE2vlaR TNTeNvO9sPQaxRbZ1LaeDBoySBEayhD8vuB6zqnvpepkbD3OLPGlPcKraFEZDSohsNbG IHHScBDJAya79DR5eSOs94d/6eY03wAihsrzPI0OF7Qgag6W/lC9aekRL+iBHUASkDuS /c+Ub1opmiq4QU56LPLuvr2SSxFZTfNKb2ONCSmyF21bkTO9q/oumZ9hMqARABCQK8+s eF/g== 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=Lu5qYuB+tjK8/mDIQYFynpxQAVOnxA6nuELbsLi9pQ0=; b=Witlkc6PfETAjz+I7Lkt5mBWoLJ7qa7yHXNXCqY/YCpl/lCKP1ocCrgjMyaNs/eIOz fqANlTyaYD9XG8GH7qOv5IP+7l8Jb2iyg8rreX8tcOySe0Z3v/zn5DV0nR0AbPjZbixu oK18Co7P/7F7ciN6PNdDdJaBzDK6iNbza2g1Dvx6+C8EfHQOQT95hvLLEtM6xXNten1/ aLC6EJBPGg1/H94QBtfM2RQMnmkbrGg4EF7BP0KznUOmY3muUD+fC5f7HYOx0QhIYmZa MHL02lHPFnGkq/SP0x+UQRu0cTz/RkG7H3arh9nTBf/9IdlirzCLqYqIHtQB0eRZshdp Q0Zg== X-Gm-Message-State: ALoCoQk17L7HehSVwNg38tdxltgPAYP6I61Ypb1ep6DLsb0GfyDNa+a0AuIQbWAUybGCcWJ4ex6T X-Received: by 10.28.24.73 with SMTP id 70mr24969304wmy.45.1446655882506; Wed, 04 Nov 2015 08:51:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.27.225.15 with HTTP; Wed, 4 Nov 2015 08:51:03 -0800 (PST) From: Jinpu Wang Date: Wed, 4 Nov 2015 17:51:03 +0100 Message-ID: Subject: [PATCH 2/3] aic94xx: 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 3aae177e7aa833339fa84ae5c60ed5f10056610d Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Wed, 4 Nov 2015 10:01:41 +0100 Subject: [PATCH 2/3] aic94xx: 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/aic94xx/aic94xx_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) kfree(asd_ha->sas_ha.sas_phy); 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);