Commit a490a07a authored by Mike Snitzer's avatar Mike Snitzer Committed by Alasdair G Kergon

dm mpath: allow table load with no priority groups

This patch adjusts the multipath target to allow a table with both 0
priority groups and 0 for the initial priority group number.

If any mpath device is held open when all paths in the last priority
group have failed, userspace multipathd will attempt to reload the
associated DM table to reflect the fact that the device no longer has
any priority groups.  But the reload attempt always failed because the
multipath target did not allow 0 priority groups.

All multipath target messages related to priority group (enable_group,
disable_group, switch_group) will handle a priority group of 0 (will
cause error).

When reloading a multipath table with 0 priority groups, userspace
multipathd must be updated to specify an initial priority group number
of 0 (rather than 1).
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Cc: Babu Moger <babu.moger@lsi.com>
Acked-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 19040c0b
...@@ -844,8 +844,8 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, ...@@ -844,8 +844,8 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc,
{ {
/* target parameters */ /* target parameters */
static struct param _params[] = { static struct param _params[] = {
{1, 1024, "invalid number of priority groups"}, {0, 1024, "invalid number of priority groups"},
{1, 1024, "invalid initial priority group number"}, {0, 1024, "invalid initial priority group number"},
}; };
int r; int r;
...@@ -879,6 +879,13 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, ...@@ -879,6 +879,13 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc,
if (r) if (r)
goto bad; 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 */ /* parse the priority groups */
while (as.argc) { while (as.argc) {
struct priority_group *pg; struct priority_group *pg;
...@@ -1415,7 +1422,7 @@ static int multipath_status(struct dm_target *ti, status_type_t type, ...@@ -1415,7 +1422,7 @@ static int multipath_status(struct dm_target *ti, status_type_t type,
else if (m->current_pg) else if (m->current_pg)
pg_num = m->current_pg->pg_num; pg_num = m->current_pg->pg_num;
else else
pg_num = 1; pg_num = (m->nr_priority_groups ? 1 : 0);
DMEMIT("%u ", pg_num); DMEMIT("%u ", pg_num);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment