diff mbox

[1/3] isci: isci: remove SCSI host before detaching from SAS transport

Message ID CAMGffE=F6PuKNV1vgesePQ29GJUCoZaScq01pT-gqROjV4DL9w@mail.gmail.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Jinpu Wang Nov. 4, 2015, 4:48 p.m. UTC
From b1fb56b6d98610251253dc4b858df509df08e813 Mon Sep 17 00:00:00 2001
From: Jack Wang <jinpu.wang@profitbricks.com>
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 <jinpu.wang@profitbricks.com>
---
 drivers/scsi/isci/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Christoph Hellwig Nov. 5, 2015, 10:23 a.m. UTC | #1
Hi Jack,

all three patches look fine to me, but it seems like your mailer mangled
the whitespaces.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jinpu Wang Nov. 5, 2015, 11:36 a.m. UTC | #2
Hi Christoph,

On Thu, Nov 5, 2015 at 11:23 AM, Christoph Hellwig <hch@lst.de> wrote:
> Hi Jack,
>
> all three patches look fine to me, but it seems like your mailer mangled
> the whitespaces.

Thanks, I've resend with git send-email.
Sorry for inconvenient.
diff mbox

Patch

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);
 }