Commit 097d0264 authored by Stephen M. Cameron's avatar Stephen M. Cameron Committed by Jens Axboe

cciss: Rearrange logical drive sysfs code to make the "changing a disk" path work.

Rearrange logical drive sysfs code to make the "changing a disk" path work.
Signed-off-by: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 617e1344
...@@ -1916,9 +1916,10 @@ static int cciss_add_gendisk(ctlr_info_t *h, __u32 lunid, int controller_node) ...@@ -1916,9 +1916,10 @@ static int cciss_add_gendisk(ctlr_info_t *h, __u32 lunid, int controller_node)
} }
} }
h->drv[drv_index].LunID = lunid; h->drv[drv_index].LunID = lunid;
if (cciss_create_ld_sysfs_entry(h, drv_index)) if (h->drv[drv_index].dev == NULL) {
goto err_free_disk; if (cciss_create_ld_sysfs_entry(h, drv_index))
goto err_free_disk;
}
/* Don't need to mark this busy because nobody */ /* Don't need to mark this busy because nobody */
/* else knows about this disk yet to contend */ /* else knows about this disk yet to contend */
/* for access to it. */ /* for access to it. */
...@@ -2145,8 +2146,10 @@ static int deregister_disk(ctlr_info_t *h, int drv_index, ...@@ -2145,8 +2146,10 @@ static int deregister_disk(ctlr_info_t *h, int drv_index,
*/ */
if (h->gendisk[0] != disk) { if (h->gendisk[0] != disk) {
struct request_queue *q = disk->queue; struct request_queue *q = disk->queue;
if (disk->flags & GENHD_FL_UP) if (disk->flags & GENHD_FL_UP) {
cciss_destroy_ld_sysfs_entry(h, drv_index);
del_gendisk(disk); del_gendisk(disk);
}
if (q) { if (q) {
blk_cleanup_queue(q); blk_cleanup_queue(q);
/* Set drv->queue to NULL so that we do not try /* Set drv->queue to NULL so that we do not try
...@@ -2190,7 +2193,6 @@ static int deregister_disk(ctlr_info_t *h, int drv_index, ...@@ -2190,7 +2193,6 @@ static int deregister_disk(ctlr_info_t *h, int drv_index,
* indicate that this element of the drive * indicate that this element of the drive
* array is free. * array is free.
*/ */
cciss_destroy_ld_sysfs_entry(h, drv_index);
if (clear_all) { if (clear_all) {
/* check to see if it was the last disk */ /* check to see if it was the last disk */
...@@ -4308,15 +4310,13 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) ...@@ -4308,15 +4310,13 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev)
if (disk) { if (disk) {
struct request_queue *q = disk->queue; struct request_queue *q = disk->queue;
if (disk->flags & GENHD_FL_UP) if (disk->flags & GENHD_FL_UP) {
cciss_destroy_ld_sysfs_entry(hba[i], j);
del_gendisk(disk); del_gendisk(disk);
}
if (q) if (q)
blk_cleanup_queue(q); blk_cleanup_queue(q);
} }
if (hba[i]->drv[j].dev != NULL &&
(j == 0 || hba[i]->drv[j].raid_level != -1))
cciss_destroy_ld_sysfs_entry(hba[i], j);
} }
#ifdef CONFIG_CISS_SCSI_TAPE #ifdef CONFIG_CISS_SCSI_TAPE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment