aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 41e2509bf896..03b4cd0a6344 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -474,7 +474,7 @@ void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
474 * causes ENOTSUPP, we allocate a spare bio... 474 * causes ENOTSUPP, we allocate a spare bio...
475 */ 475 */
476 struct bio *bio = bio_alloc(GFP_NOIO, 1); 476 struct bio *bio = bio_alloc(GFP_NOIO, 1);
477 int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNC); 477 int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG);
478 478
479 bio->bi_bdev = rdev->bdev; 479 bio->bi_bdev = rdev->bdev;
480 bio->bi_sector = sector; 480 bio->bi_sector = sector;
@@ -531,7 +531,7 @@ int sync_page_io(struct block_device *bdev, sector_t sector, int size,
531 struct completion event; 531 struct completion event;
532 int ret; 532 int ret;
533 533
534 rw |= (1 << BIO_RW_SYNC); 534 rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
535 535
536 bio->bi_bdev = bdev; 536 bio->bi_bdev = bdev;
537 bio->bi_sector = sector; 537 bio->bi_sector = sector;
@@ -1481,6 +1481,11 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1481 if (find_rdev_nr(mddev, rdev->desc_nr)) 1481 if (find_rdev_nr(mddev, rdev->desc_nr))
1482 return -EBUSY; 1482 return -EBUSY;
1483 } 1483 }
1484 if (mddev->max_disks && rdev->desc_nr >= mddev->max_disks) {
1485 printk(KERN_WARNING "md: %s: array is limited to %d devices\n",
1486 mdname(mddev), mddev->max_disks);
1487 return -EBUSY;
1488 }
1484 bdevname(rdev->bdev,b); 1489 bdevname(rdev->bdev,b);
1485 while ( (s=strchr(b, '/')) != NULL) 1490 while ( (s=strchr(b, '/')) != NULL)
1486 *s = '!'; 1491 *s = '!';
@@ -2441,6 +2446,15 @@ static void analyze_sbs(mddev_t * mddev)
2441 2446
2442 i = 0; 2447 i = 0;
2443 rdev_for_each(rdev, tmp, mddev) { 2448 rdev_for_each(rdev, tmp, mddev) {
2449 if (rdev->desc_nr >= mddev->max_disks ||
2450 i > mddev->max_disks) {
2451 printk(KERN_WARNING
2452 "md: %s: %s: only %d devices permitted\n",
2453 mdname(mddev), bdevname(rdev->bdev, b),
2454 mddev->max_disks);
2455 kick_rdev_from_array(rdev);
2456 continue;
2457 }
2444 if (rdev != freshest) 2458 if (rdev != freshest)
2445 if (super_types[mddev->major_version]. 2459 if (super_types[mddev->major_version].
2446 validate_super(mddev, rdev)) { 2460 validate_super(mddev, rdev)) {
@@ -4614,13 +4628,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
4614 * noticed in interrupt contexts ... 4628 * noticed in interrupt contexts ...
4615 */ 4629 */
4616 4630
4617 if (rdev->desc_nr == mddev->max_disks) {
4618 printk(KERN_WARNING "%s: can not hot-add to full array!\n",
4619 mdname(mddev));
4620 err = -EBUSY;
4621 goto abort_unbind_export;
4622 }
4623
4624 rdev->raid_disk = -1; 4631 rdev->raid_disk = -1;
4625 4632
4626 md_update_sb(mddev, 1); 4633 md_update_sb(mddev, 1);
@@ -4634,9 +4641,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
4634 md_new_event(mddev); 4641 md_new_event(mddev);
4635 return 0; 4642 return 0;
4636 4643
4637abort_unbind_export:
4638 unbind_rdev_from_array(rdev);
4639
4640abort_export: 4644abort_export:
4641 export_rdev(rdev); 4645 export_rdev(rdev);
4642 return err; 4646 return err;