diff options
Diffstat (limited to 'drivers/md/dm-mpath.c')
-rw-r--r-- | drivers/md/dm-mpath.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 4b0b63c290a6..a550a057d991 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -844,8 +844,8 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, | |||
844 | { | 844 | { |
845 | /* target parameters */ | 845 | /* target parameters */ |
846 | static struct param _params[] = { | 846 | static struct param _params[] = { |
847 | {1, 1024, "invalid number of priority groups"}, | 847 | {0, 1024, "invalid number of priority groups"}, |
848 | {1, 1024, "invalid initial priority group number"}, | 848 | {0, 1024, "invalid initial priority group number"}, |
849 | }; | 849 | }; |
850 | 850 | ||
851 | int r; | 851 | int r; |
@@ -879,6 +879,13 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, | |||
879 | if (r) | 879 | if (r) |
880 | goto bad; | 880 | goto bad; |
881 | 881 | ||
882 | if ((!m->nr_priority_groups && next_pg_num) || | ||
883 | (m->nr_priority_groups && !next_pg_num)) { | ||
884 | ti->error = "invalid initial priority group"; | ||
885 | r = -EINVAL; | ||
886 | goto bad; | ||
887 | } | ||
888 | |||
882 | /* parse the priority groups */ | 889 | /* parse the priority groups */ |
883 | while (as.argc) { | 890 | while (as.argc) { |
884 | struct priority_group *pg; | 891 | struct priority_group *pg; |
@@ -1065,7 +1072,7 @@ out: | |||
1065 | static int action_dev(struct multipath *m, struct dm_dev *dev, | 1072 | static int action_dev(struct multipath *m, struct dm_dev *dev, |
1066 | action_fn action) | 1073 | action_fn action) |
1067 | { | 1074 | { |
1068 | int r = 0; | 1075 | int r = -EINVAL; |
1069 | struct pgpath *pgpath; | 1076 | struct pgpath *pgpath; |
1070 | struct priority_group *pg; | 1077 | struct priority_group *pg; |
1071 | 1078 | ||
@@ -1415,7 +1422,7 @@ static int multipath_status(struct dm_target *ti, status_type_t type, | |||
1415 | else if (m->current_pg) | 1422 | else if (m->current_pg) |
1416 | pg_num = m->current_pg->pg_num; | 1423 | pg_num = m->current_pg->pg_num; |
1417 | else | 1424 | else |
1418 | pg_num = 1; | 1425 | pg_num = (m->nr_priority_groups ? 1 : 0); |
1419 | 1426 | ||
1420 | DMEMIT("%u ", pg_num); | 1427 | DMEMIT("%u ", pg_num); |
1421 | 1428 | ||
@@ -1669,7 +1676,7 @@ out: | |||
1669 | *---------------------------------------------------------------*/ | 1676 | *---------------------------------------------------------------*/ |
1670 | static struct target_type multipath_target = { | 1677 | static struct target_type multipath_target = { |
1671 | .name = "multipath", | 1678 | .name = "multipath", |
1672 | .version = {1, 2, 0}, | 1679 | .version = {1, 3, 0}, |
1673 | .module = THIS_MODULE, | 1680 | .module = THIS_MODULE, |
1674 | .ctr = multipath_ctr, | 1681 | .ctr = multipath_ctr, |
1675 | .dtr = multipath_dtr, | 1682 | .dtr = multipath_dtr, |