From: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
To: linux-scsi@vger.kernel.org
Cc: michaelc@cs.wisc.edu, JBottomley@parallels.com,
linux-kernel@vger.kernel.org, kxie@chelsio.com,
Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>,
Divy La Rey <divy@chelsio.com>
Subject: [PATCH] cxgb4i: Remove the scsi host device when removing device
Date: Fri, 11 Jan 2013 17:12:09 -0200 [thread overview]
Message-ID: <1357931529-10248-1-git-send-email-cascardo@linux.vnet.ibm.com> (raw)
When doing a hotplug remove of a cxgb4 device, there are still dandling
symlinks at /sys/class/scsi_host/hostX to the removed PCI device. The
upper layer device may also try to send data, which may crash the
system.
The DETACH message from the lower level driver is sent to the ULD when
the device is removed, when the scsi host should be removed from the
system, avoiding any problems.
After this patch, there are no more dangling symlinks and many attempts
to crash the system while there is SCSI activity and removing the device
have failed. Adding the device back again works as expected, with the
scsi hosts showing up again.
Based on a patch by Karen Xie.
Cc: Karen Xie <kxie@chelsio.com>
Cc: Divy La Rey <divy@chelsio.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
---
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index f924b3c..3fecf35 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -1564,6 +1564,7 @@ static int t4_uld_state_change(void *handle, enum cxgb4_state state)
break;
case CXGB4_STATE_DETACH:
pr_info("cdev 0x%p, DETACH.\n", cdev);
+ cxgbi_device_unregister(cdev);
break;
default:
pr_info("cdev 0x%p, unknown state %d.\n", cdev, state);
--
1.7.1
next reply other threads:[~2013-01-11 19:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 19:12 Thadeu Lima de Souza Cascardo [this message]
2013-01-17 5:17 ` [PATCH] cxgb4i: Remove the scsi host device when removing device Mike Christie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357931529-10248-1-git-send-email-cascardo@linux.vnet.ibm.com \
--to=cascardo@linux.vnet.ibm.com \
--cc=JBottomley@parallels.com \
--cc=divy@chelsio.com \
--cc=kxie@chelsio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).