diff options
-rw-r--r-- | drivers/md/linear.c | 6 | ||||
-rw-r--r-- | drivers/md/md.c | 24 | ||||
-rw-r--r-- | drivers/md/raid1.c | 3 |
3 files changed, 19 insertions, 14 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 1e3aea9eecf1..09658b218474 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -25,13 +25,13 @@ static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector) | |||
25 | { | 25 | { |
26 | dev_info_t *hash; | 26 | dev_info_t *hash; |
27 | linear_conf_t *conf = mddev_to_conf(mddev); | 27 | linear_conf_t *conf = mddev_to_conf(mddev); |
28 | sector_t idx = sector >> conf->sector_shift; | ||
28 | 29 | ||
29 | /* | 30 | /* |
30 | * sector_div(a,b) returns the remainer and sets a to a/b | 31 | * sector_div(a,b) returns the remainer and sets a to a/b |
31 | */ | 32 | */ |
32 | sector >>= conf->sector_shift; | 33 | (void)sector_div(idx, conf->spacing); |
33 | (void)sector_div(sector, conf->spacing); | 34 | hash = conf->hash_table[idx]; |
34 | hash = conf->hash_table[sector]; | ||
35 | 35 | ||
36 | while (sector >= hash->num_sectors + hash->start_sector) | 36 | while (sector >= hash->num_sectors + hash->start_sector) |
37 | hash++; | 37 | hash++; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 41e2509bf896..4495104f6c9f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -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 | ||
4637 | abort_unbind_export: | ||
4638 | unbind_rdev_from_array(rdev); | ||
4639 | |||
4640 | abort_export: | 4644 | abort_export: |
4641 | export_rdev(rdev); | 4645 | export_rdev(rdev); |
4642 | return err; | 4646 | return err; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 7b4f5f7155d8..01e3cffd03b8 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1640,7 +1640,8 @@ static void raid1d(mddev_t *mddev) | |||
1640 | } | 1640 | } |
1641 | 1641 | ||
1642 | bio = r1_bio->bios[r1_bio->read_disk]; | 1642 | bio = r1_bio->bios[r1_bio->read_disk]; |
1643 | if ((disk=read_balance(conf, r1_bio)) == -1) { | 1643 | if ((disk=read_balance(conf, r1_bio)) == -1 || |
1644 | disk == r1_bio->read_disk) { | ||
1644 | printk(KERN_ALERT "raid1: %s: unrecoverable I/O" | 1645 | printk(KERN_ALERT "raid1: %s: unrecoverable I/O" |
1645 | " read error for block %llu\n", | 1646 | " read error for block %llu\n", |
1646 | bdevname(bio->bi_bdev,b), | 1647 | bdevname(bio->bi_bdev,b), |