mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
dm mpath: use more error codes
This patch allows path errors from the multipath ctr function to propagate up to userspace as errno values from the ioctl() call. This is in response to https://www.redhat.com/archives/dm-devel/2008-May/msg00000.html and https://bugzilla.redhat.com/show_bug.cgi?id=444421 The patch only lets through the errors that it needs to in order to get the path errors from parse_path(). Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
parent
3fa8749e58
commit
01460f3520
1 changed files with 12 additions and 10 deletions
|
@ -563,12 +563,12 @@ static struct pgpath *parse_path(struct arg_set *as, struct path_selector *ps,
|
||||||
/* we need at least a path arg */
|
/* we need at least a path arg */
|
||||||
if (as->argc < 1) {
|
if (as->argc < 1) {
|
||||||
ti->error = "no device given";
|
ti->error = "no device given";
|
||||||
return NULL;
|
return ERR_PTR(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
p = alloc_pgpath();
|
p = alloc_pgpath();
|
||||||
if (!p)
|
if (!p)
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
r = dm_get_device(ti, shift(as), ti->begin, ti->len,
|
r = dm_get_device(ti, shift(as), ti->begin, ti->len,
|
||||||
dm_table_get_mode(ti->table), &p->path.dev);
|
dm_table_get_mode(ti->table), &p->path.dev);
|
||||||
|
@ -596,7 +596,7 @@ static struct pgpath *parse_path(struct arg_set *as, struct path_selector *ps,
|
||||||
|
|
||||||
bad:
|
bad:
|
||||||
free_pgpath(p);
|
free_pgpath(p);
|
||||||
return NULL;
|
return ERR_PTR(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct priority_group *parse_priority_group(struct arg_set *as,
|
static struct priority_group *parse_priority_group(struct arg_set *as,
|
||||||
|
@ -614,14 +614,14 @@ static struct priority_group *parse_priority_group(struct arg_set *as,
|
||||||
|
|
||||||
if (as->argc < 2) {
|
if (as->argc < 2) {
|
||||||
as->argc = 0;
|
as->argc = 0;
|
||||||
ti->error = "not enough priority group aruments";
|
ti->error = "not enough priority group arguments";
|
||||||
return NULL;
|
return ERR_PTR(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
pg = alloc_priority_group();
|
pg = alloc_priority_group();
|
||||||
if (!pg) {
|
if (!pg) {
|
||||||
ti->error = "couldn't allocate priority group";
|
ti->error = "couldn't allocate priority group";
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
}
|
}
|
||||||
pg->m = m;
|
pg->m = m;
|
||||||
|
|
||||||
|
@ -654,8 +654,10 @@ static struct priority_group *parse_priority_group(struct arg_set *as,
|
||||||
path_args.argv = as->argv;
|
path_args.argv = as->argv;
|
||||||
|
|
||||||
pgpath = parse_path(&path_args, &pg->ps, ti);
|
pgpath = parse_path(&path_args, &pg->ps, ti);
|
||||||
if (!pgpath)
|
if (IS_ERR(pgpath)) {
|
||||||
|
r = PTR_ERR(pgpath);
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
|
|
||||||
pgpath->pg = pg;
|
pgpath->pg = pg;
|
||||||
list_add_tail(&pgpath->list, &pg->pgpaths);
|
list_add_tail(&pgpath->list, &pg->pgpaths);
|
||||||
|
@ -666,7 +668,7 @@ static struct priority_group *parse_priority_group(struct arg_set *as,
|
||||||
|
|
||||||
bad:
|
bad:
|
||||||
free_priority_group(pg, ti);
|
free_priority_group(pg, ti);
|
||||||
return NULL;
|
return ERR_PTR(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_hw_handler(struct arg_set *as, struct multipath *m)
|
static int parse_hw_handler(struct arg_set *as, struct multipath *m)
|
||||||
|
@ -785,8 +787,8 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc,
|
||||||
struct priority_group *pg;
|
struct priority_group *pg;
|
||||||
|
|
||||||
pg = parse_priority_group(&as, m);
|
pg = parse_priority_group(&as, m);
|
||||||
if (!pg) {
|
if (IS_ERR(pg)) {
|
||||||
r = -EINVAL;
|
r = PTR_ERR(pg);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue