aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-mpath.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 52f0de394632..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;
@@ -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