aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r--drivers/block/cciss.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index ced71b006cd7..aa95eeb30206 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -682,6 +682,10 @@ static long cciss_create_ld_sysfs_entry(struct ctlr_info *h,
682{ 682{
683 struct device *dev; 683 struct device *dev;
684 684
685 /* Special case for c*d0, we only create it once. */
686 if (drv_index == 0 && h->drv[drv_index].dev != NULL)
687 return 0;
688
685 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 689 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
686 if (!dev) 690 if (!dev)
687 return -ENOMEM; 691 return -ENOMEM;
@@ -698,9 +702,15 @@ static long cciss_create_ld_sysfs_entry(struct ctlr_info *h,
698/* 702/*
699 * Remove sysfs entries for a logical drive. 703 * Remove sysfs entries for a logical drive.
700 */ 704 */
701static void cciss_destroy_ld_sysfs_entry(struct ctlr_info *h, int drv_index) 705static void cciss_destroy_ld_sysfs_entry(struct ctlr_info *h, int drv_index,
706 int ctlr_exiting)
702{ 707{
703 struct device *dev = h->drv[drv_index].dev; 708 struct device *dev = h->drv[drv_index].dev;
709
710 /* special case for c*d0, we only destroy it on controller exit */
711 if (drv_index == 0 && !ctlr_exiting)
712 return;
713
704 device_del(dev); 714 device_del(dev);
705 put_device(dev); /* the "final" put. */ 715 put_device(dev); /* the "final" put. */
706 h->drv[drv_index].dev = NULL; 716 h->drv[drv_index].dev = NULL;
@@ -1920,6 +1930,7 @@ static int cciss_add_gendisk(ctlr_info_t *h, __u32 lunid, int controller_node)
1920 drv_index = cciss_find_free_drive_index(h->ctlr, controller_node); 1930 drv_index = cciss_find_free_drive_index(h->ctlr, controller_node);
1921 if (drv_index == -1) 1931 if (drv_index == -1)
1922 return -1; 1932 return -1;
1933
1923 /*Check if the gendisk needs to be allocated */ 1934 /*Check if the gendisk needs to be allocated */
1924 if (!h->gendisk[drv_index]) { 1935 if (!h->gendisk[drv_index]) {
1925 h->gendisk[drv_index] = 1936 h->gendisk[drv_index] =
@@ -2165,7 +2176,7 @@ static int deregister_disk(ctlr_info_t *h, int drv_index,
2165 if (h->gendisk[0] != disk) { 2176 if (h->gendisk[0] != disk) {
2166 struct request_queue *q = disk->queue; 2177 struct request_queue *q = disk->queue;
2167 if (disk->flags & GENHD_FL_UP) { 2178 if (disk->flags & GENHD_FL_UP) {
2168 cciss_destroy_ld_sysfs_entry(h, drv_index); 2179 cciss_destroy_ld_sysfs_entry(h, drv_index, 0);
2169 del_gendisk(disk); 2180 del_gendisk(disk);
2170 } 2181 }
2171 if (q) { 2182 if (q) {
@@ -2211,7 +2222,6 @@ static int deregister_disk(ctlr_info_t *h, int drv_index,
2211 * indicate that this element of the drive 2222 * indicate that this element of the drive
2212 * array is free. 2223 * array is free.
2213 */ 2224 */
2214
2215 if (clear_all) { 2225 if (clear_all) {
2216 /* check to see if it was the last disk */ 2226 /* check to see if it was the last disk */
2217 if (drv == h->drv + h->highest_lun) { 2227 if (drv == h->drv + h->highest_lun) {
@@ -4329,7 +4339,7 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev)
4329 struct request_queue *q = disk->queue; 4339 struct request_queue *q = disk->queue;
4330 4340
4331 if (disk->flags & GENHD_FL_UP) { 4341 if (disk->flags & GENHD_FL_UP) {
4332 cciss_destroy_ld_sysfs_entry(hba[i], j); 4342 cciss_destroy_ld_sysfs_entry(hba[i], j, 1);
4333 del_gendisk(disk); 4343 del_gendisk(disk);
4334 } 4344 }
4335 if (q) 4345 if (q)