aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorThadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>2013-01-11 14:12:09 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-01-29 19:58:06 -0500
commitc3b331a308b6369b77455f8431f3182931cf7686 (patch)
treea487c300e1ef6b1b939bcd1f3871f26b9914fa09 /drivers/scsi
parent30ac379a6921b14f4c44e13875d39b8f8f478958 (diff)
[SCSI] cxgb4i: Remove the scsi host device when removing device
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. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> Cc: Karen Xie <kxie@chelsio.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/cxgbi/cxgb4i/cxgb4i.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index f924b3c3720e..3fecf35ba292 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)
1564 break; 1564 break;
1565 case CXGB4_STATE_DETACH: 1565 case CXGB4_STATE_DETACH:
1566 pr_info("cdev 0x%p, DETACH.\n", cdev); 1566 pr_info("cdev 0x%p, DETACH.\n", cdev);
1567 cxgbi_device_unregister(cdev);
1567 break; 1568 break;
1568 default: 1569 default:
1569 pr_info("cdev 0x%p, unknown state %d.\n", cdev, state); 1570 pr_info("cdev 0x%p, unknown state %d.\n", cdev, state);