aboutsummaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authormikem <mikem@beardog.cca.cpqcorp.net>2005-11-18 22:05:36 +0100
committerJens Axboe <axboe@suse.de>2005-11-18 22:05:36 +0100
commit6f5a0f7c955d3567f800fa36f978758cb5b99aa2 (patch)
treeae4c3e9c46c8c02bbcf97c40f6e2e09865327569 /drivers/block
parent15534d3803993345d8db32246ec329d8f83502e1 (diff)
[PATCH 3/3] cciss: add put_disk into cleanup routines
Jeff Garzik pointed me to his code to see how to remove a disk from the system _properly_. Well, here it is... Every place we remove disks we are now testing before calling del_gendisk or blk_cleanup_queue and then call put_disk. Signed-off-by: Mike Miller <mike.miller@hp.com> Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/cciss.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 33f8341887d..a9e33db46e6 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1139,8 +1139,15 @@ static int revalidate_allvol(ctlr_info_t *host)
for(i=0; i< NWD; i++) {
struct gendisk *disk = host->gendisk[i];
- if (disk->flags & GENHD_FL_UP)
- del_gendisk(disk);
+ if (disk) {
+ request_queue_t *q = disk->queue;
+
+ if (disk->flags & GENHD_FL_UP)
+ del_gendisk(disk);
+ if (q)
+ blk_cleanup_queue(q);
+ put_disk(disk);
+ }
}
/*
@@ -1454,10 +1461,13 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
* allows us to delete disk zero but keep the controller registered.
*/
if (h->gendisk[0] != disk){
- if (disk->flags & GENHD_FL_UP){
- blk_cleanup_queue(disk->queue);
- del_gendisk(disk);
- drv->queue = NULL;
+ if (disk) {
+ request_queue_t *q = disk->queue;
+ if (disk->flags & GENHD_FL_UP)
+ del_gendisk(disk);
+ if (q)
+ blk_cleanup_queue(q);
+ put_disk(disk);
}
}
@@ -3226,9 +3236,14 @@ static void __devexit cciss_remove_one (struct pci_dev *pdev)
/* remove it from the disk list */
for (j = 0; j < NWD; j++) {
struct gendisk *disk = hba[i]->gendisk[j];
- if (disk->flags & GENHD_FL_UP) {
- del_gendisk(disk);
- blk_cleanup_queue(disk->queue);
+ if (disk) {
+ request_queue_t *q = disk->queue;
+
+ if (disk->flags & GENHD_FL_UP)
+ del_gendisk(disk);
+ if (q)
+ blk_cleanup_queue(q);
+ put_disk(disk);
}
}