aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscameron@beardog.cca.cpqcorp.net <scameron@beardog.cca.cpqcorp.net>2008-04-17 07:19:03 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-04-21 03:50:09 -0400
commite14ac67026b46e94478134df9521682fc6501ac0 (patch)
treeea6f6e2e818f5fbb930c9f40a9a0431aef713494
parentf18573abcc57844a7c3c12699d40eead8728cd8a (diff)
cciss: Fix race between disk-adding code and interrupt handler
Fix race condition between cciss_init_one(), cciss_update_drive_info(), and cciss_check_queues(). Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--drivers/block/cciss.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 9c9627e8e334..cf6083a1f928 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1349,6 +1349,10 @@ static void cciss_update_drive_info(int ctlr, int drv_index)
1349 spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); 1349 spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
1350 h->drv[drv_index].busy_configuring = 1; 1350 h->drv[drv_index].busy_configuring = 1;
1351 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); 1351 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
1352
1353 /* deregister_disk sets h->drv[drv_index].queue = NULL */
1354 /* which keeps the interrupt handler from starting */
1355 /* the queue. */
1352 ret = deregister_disk(h->gendisk[drv_index], 1356 ret = deregister_disk(h->gendisk[drv_index],
1353 &h->drv[drv_index], 0); 1357 &h->drv[drv_index], 0);
1354 h->drv[drv_index].busy_configuring = 0; 1358 h->drv[drv_index].busy_configuring = 0;
@@ -1419,6 +1423,10 @@ geo_inq:
1419 blk_queue_hardsect_size(disk->queue, 1423 blk_queue_hardsect_size(disk->queue,
1420 hba[ctlr]->drv[drv_index].block_size); 1424 hba[ctlr]->drv[drv_index].block_size);
1421 1425
1426 /* Make sure all queue data is written out before */
1427 /* setting h->drv[drv_index].queue, as setting this */
1428 /* allows the interrupt handler to start the queue */
1429 wmb();
1422 h->drv[drv_index].queue = disk->queue; 1430 h->drv[drv_index].queue = disk->queue;
1423 add_disk(disk); 1431 add_disk(disk);
1424 } 1432 }
@@ -3520,10 +3528,17 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3520 continue; 3528 continue;
3521 blk_queue_hardsect_size(q, drv->block_size); 3529 blk_queue_hardsect_size(q, drv->block_size);
3522 set_capacity(disk, drv->nr_blocks); 3530 set_capacity(disk, drv->nr_blocks);
3523 add_disk(disk);
3524 j++; 3531 j++;
3525 } while (j <= hba[i]->highest_lun); 3532 } while (j <= hba[i]->highest_lun);
3526 3533
3534 /* Make sure all queue data is written out before */
3535 /* interrupt handler, triggered by add_disk, */
3536 /* is allowed to start them. */
3537 wmb();
3538
3539 for (j = 0; j <= hba[i]->highest_lun; j++)
3540 add_disk(hba[i]->gendisk[j]);
3541
3527 return 1; 3542 return 1;
3528 3543
3529 clean4: 3544 clean4: