diff options
author | mikem <mikem@beardog.cca.cpqcorp.net> | 2005-11-18 16:05:36 -0500 |
---|---|---|
committer | Jens Axboe <axboe@suse.de> | 2005-11-18 16:05:36 -0500 |
commit | 6f5a0f7c955d3567f800fa36f978758cb5b99aa2 (patch) | |
tree | ae4c3e9c46c8c02bbcf97c40f6e2e09865327569 /drivers/block | |
parent | 15534d3803993345d8db32246ec329d8f83502e1 (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.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 33f8341887d0..a9e33db46e68 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1139,8 +1139,15 @@ static int revalidate_allvol(ctlr_info_t *host) | |||
1139 | 1139 | ||
1140 | for(i=0; i< NWD; i++) { | 1140 | for(i=0; i< NWD; i++) { |
1141 | struct gendisk *disk = host->gendisk[i]; | 1141 | struct gendisk *disk = host->gendisk[i]; |
1142 | if (disk->flags & GENHD_FL_UP) | 1142 | if (disk) { |
1143 | del_gendisk(disk); | 1143 | request_queue_t *q = disk->queue; |
1144 | |||
1145 | if (disk->flags & GENHD_FL_UP) | ||
1146 | del_gendisk(disk); | ||
1147 | if (q) | ||
1148 | blk_cleanup_queue(q); | ||
1149 | put_disk(disk); | ||
1150 | } | ||
1144 | } | 1151 | } |
1145 | 1152 | ||
1146 | /* | 1153 | /* |
@@ -1454,10 +1461,13 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | |||
1454 | * allows us to delete disk zero but keep the controller registered. | 1461 | * allows us to delete disk zero but keep the controller registered. |
1455 | */ | 1462 | */ |
1456 | if (h->gendisk[0] != disk){ | 1463 | if (h->gendisk[0] != disk){ |
1457 | if (disk->flags & GENHD_FL_UP){ | 1464 | if (disk) { |
1458 | blk_cleanup_queue(disk->queue); | 1465 | request_queue_t *q = disk->queue; |
1459 | del_gendisk(disk); | 1466 | if (disk->flags & GENHD_FL_UP) |
1460 | drv->queue = NULL; | 1467 | del_gendisk(disk); |
1468 | if (q) | ||
1469 | blk_cleanup_queue(q); | ||
1470 | put_disk(disk); | ||
1461 | } | 1471 | } |
1462 | } | 1472 | } |
1463 | 1473 | ||
@@ -3226,9 +3236,14 @@ static void __devexit cciss_remove_one (struct pci_dev *pdev) | |||
3226 | /* remove it from the disk list */ | 3236 | /* remove it from the disk list */ |
3227 | for (j = 0; j < NWD; j++) { | 3237 | for (j = 0; j < NWD; j++) { |
3228 | struct gendisk *disk = hba[i]->gendisk[j]; | 3238 | struct gendisk *disk = hba[i]->gendisk[j]; |
3229 | if (disk->flags & GENHD_FL_UP) { | 3239 | if (disk) { |
3230 | del_gendisk(disk); | 3240 | request_queue_t *q = disk->queue; |
3231 | blk_cleanup_queue(disk->queue); | 3241 | |
3242 | if (disk->flags & GENHD_FL_UP) | ||
3243 | del_gendisk(disk); | ||
3244 | if (q) | ||
3245 | blk_cleanup_queue(q); | ||
3246 | put_disk(disk); | ||
3232 | } | 3247 | } |
3233 | } | 3248 | } |
3234 | 3249 | ||