From 7ec2b5818e36b814531bb73eecd8738b1701e31c Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Thu, 24 Mar 2011 13:54:33 +0000 Subject: [PATCH] --- yaml --- r: 242565 b: refs/heads/master c: a490a07a67b7a37f588021410e06b721a752fc34 h: refs/heads/master i: 242563: a76432166b77bc49852f40b395c220655be16e0f v: v3 --- [refs] | 2 +- trunk/drivers/md/dm-mpath.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 60ee574d796b..f8c95cf00608 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 19040c0bc8efcb767221d8ef7bb9c32ff0586179 +refs/heads/master: a490a07a67b7a37f588021410e06b721a752fc34 diff --git a/trunk/drivers/md/dm-mpath.c b/trunk/drivers/md/dm-mpath.c index 52f0de394632..a550a057d991 100644 --- a/trunk/drivers/md/dm-mpath.c +++ b/trunk/drivers/md/dm-mpath.c @@ -844,8 +844,8 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, { /* target parameters */ static struct param _params[] = { - {1, 1024, "invalid number of priority groups"}, - {1, 1024, "invalid initial priority group number"}, + {0, 1024, "invalid number of priority groups"}, + {0, 1024, "invalid initial priority group number"}, }; int r; @@ -879,6 +879,13 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, if (r) goto bad; + if ((!m->nr_priority_groups && next_pg_num) || + (m->nr_priority_groups && !next_pg_num)) { + ti->error = "invalid initial priority group"; + r = -EINVAL; + goto bad; + } + /* parse the priority groups */ while (as.argc) { struct priority_group *pg; @@ -1415,7 +1422,7 @@ static int multipath_status(struct dm_target *ti, status_type_t type, else if (m->current_pg) pg_num = m->current_pg->pg_num; else - pg_num = 1; + pg_num = (m->nr_priority_groups ? 1 : 0); DMEMIT("%u ", pg_num);