Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 319472
b: refs/heads/master
c: f999e8f
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan E Brassow authored and Alasdair G Kergon committed Jul 27, 2012
1 parent c13555c commit 3cdb003
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a58a935d5a1b2ad267017a68c3a1bca26226cc76
refs/heads/master: f999e8fe70bd0b8faa27ccdac14b5942999c6e78
25 changes: 20 additions & 5 deletions trunk/drivers/md/dm-raid.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,28 @@ static int parse_raid_params(struct raid_set *rs, char **argv,

if (!strcasecmp(key, "rebuild")) {
rebuild_cnt++;
if (((rs->raid_type->level != 1) &&
(rebuild_cnt > rs->raid_type->parity_devs)) ||
((rs->raid_type->level == 1) &&
(rebuild_cnt > (rs->md.raid_disks - 1)))) {
rs->ti->error = "Too many rebuild devices specified for given RAID type";

switch (rs->raid_type->level) {
case 1:
if (rebuild_cnt >= rs->md.raid_disks) {
rs->ti->error = "Too many rebuild devices specified";
return -EINVAL;
}
break;
case 4:
case 5:
case 6:
if (rebuild_cnt > rs->raid_type->parity_devs) {
rs->ti->error = "Too many rebuild devices specified for given RAID type";
return -EINVAL;
}
break;
default:
DMERR("The rebuild parameter is not supported for %s", rs->raid_type->name);
rs->ti->error = "Rebuild not supported for this RAID type";
return -EINVAL;
}

if (value > rs->md.raid_disks) {
rs->ti->error = "Invalid rebuild index given";
return -EINVAL;
Expand Down

0 comments on commit 3cdb003

Please sign in to comment.