mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
Merge branch 'for-linus' of git://neil.brown.name/md
* 'for-linus' of git://neil.brown.name/md: md: Ensure an md array never has too many devices. md: Fix a bug in linear.c causing which_dev() to return the wrong device. md: Allow read error in a single drive raid1 to be passed up.
This commit is contained in:
commit
b2a740aab8
3 changed files with 19 additions and 14 deletions
|
@ -25,13 +25,13 @@ static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector)
|
||||||
{
|
{
|
||||||
dev_info_t *hash;
|
dev_info_t *hash;
|
||||||
linear_conf_t *conf = mddev_to_conf(mddev);
|
linear_conf_t *conf = mddev_to_conf(mddev);
|
||||||
|
sector_t idx = sector >> conf->sector_shift;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sector_div(a,b) returns the remainer and sets a to a/b
|
* sector_div(a,b) returns the remainer and sets a to a/b
|
||||||
*/
|
*/
|
||||||
sector >>= conf->sector_shift;
|
(void)sector_div(idx, conf->spacing);
|
||||||
(void)sector_div(sector, conf->spacing);
|
hash = conf->hash_table[idx];
|
||||||
hash = conf->hash_table[sector];
|
|
||||||
|
|
||||||
while (sector >= hash->num_sectors + hash->start_sector)
|
while (sector >= hash->num_sectors + hash->start_sector)
|
||||||
hash++;
|
hash++;
|
||||||
|
|
|
@ -1481,6 +1481,11 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
|
||||||
if (find_rdev_nr(mddev, rdev->desc_nr))
|
if (find_rdev_nr(mddev, rdev->desc_nr))
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
if (mddev->max_disks && rdev->desc_nr >= mddev->max_disks) {
|
||||||
|
printk(KERN_WARNING "md: %s: array is limited to %d devices\n",
|
||||||
|
mdname(mddev), mddev->max_disks);
|
||||||
|
return -EBUSY;
|
||||||
|
}
|
||||||
bdevname(rdev->bdev,b);
|
bdevname(rdev->bdev,b);
|
||||||
while ( (s=strchr(b, '/')) != NULL)
|
while ( (s=strchr(b, '/')) != NULL)
|
||||||
*s = '!';
|
*s = '!';
|
||||||
|
@ -2441,6 +2446,15 @@ static void analyze_sbs(mddev_t * mddev)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
rdev_for_each(rdev, tmp, mddev) {
|
rdev_for_each(rdev, tmp, mddev) {
|
||||||
|
if (rdev->desc_nr >= mddev->max_disks ||
|
||||||
|
i > mddev->max_disks) {
|
||||||
|
printk(KERN_WARNING
|
||||||
|
"md: %s: %s: only %d devices permitted\n",
|
||||||
|
mdname(mddev), bdevname(rdev->bdev, b),
|
||||||
|
mddev->max_disks);
|
||||||
|
kick_rdev_from_array(rdev);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (rdev != freshest)
|
if (rdev != freshest)
|
||||||
if (super_types[mddev->major_version].
|
if (super_types[mddev->major_version].
|
||||||
validate_super(mddev, rdev)) {
|
validate_super(mddev, rdev)) {
|
||||||
|
@ -4614,13 +4628,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
|
||||||
* noticed in interrupt contexts ...
|
* noticed in interrupt contexts ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (rdev->desc_nr == mddev->max_disks) {
|
|
||||||
printk(KERN_WARNING "%s: can not hot-add to full array!\n",
|
|
||||||
mdname(mddev));
|
|
||||||
err = -EBUSY;
|
|
||||||
goto abort_unbind_export;
|
|
||||||
}
|
|
||||||
|
|
||||||
rdev->raid_disk = -1;
|
rdev->raid_disk = -1;
|
||||||
|
|
||||||
md_update_sb(mddev, 1);
|
md_update_sb(mddev, 1);
|
||||||
|
@ -4634,9 +4641,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
|
||||||
md_new_event(mddev);
|
md_new_event(mddev);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
abort_unbind_export:
|
|
||||||
unbind_rdev_from_array(rdev);
|
|
||||||
|
|
||||||
abort_export:
|
abort_export:
|
||||||
export_rdev(rdev);
|
export_rdev(rdev);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -1640,7 +1640,8 @@ static void raid1d(mddev_t *mddev)
|
||||||
}
|
}
|
||||||
|
|
||||||
bio = r1_bio->bios[r1_bio->read_disk];
|
bio = r1_bio->bios[r1_bio->read_disk];
|
||||||
if ((disk=read_balance(conf, r1_bio)) == -1) {
|
if ((disk=read_balance(conf, r1_bio)) == -1 ||
|
||||||
|
disk == r1_bio->read_disk) {
|
||||||
printk(KERN_ALERT "raid1: %s: unrecoverable I/O"
|
printk(KERN_ALERT "raid1: %s: unrecoverable I/O"
|
||||||
" read error for block %llu\n",
|
" read error for block %llu\n",
|
||||||
bdevname(bio->bi_bdev,b),
|
bdevname(bio->bi_bdev,b),
|
||||||
|
|
Loading…
Reference in a new issue