diff options
author | Benjamin Marzinski <bmarzins@redhat.com> | 2008-10-10 08:36:57 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-10-10 08:36:57 -0400 |
commit | 01460f3520c100010aacc8f8500cafcb17ce4665 (patch) | |
tree | 9f883266f2b0623a876635746d8e2cf7a136a6fc /drivers/md/dm-mpath.c | |
parent | 3fa8749e584b55f1180411ab1b51117190bac1e5 (diff) |
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>
Diffstat (limited to 'drivers/md/dm-mpath.c')
-rw-r--r-- | drivers/md/dm-mpath.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index c2fcf28b4c70..c2ff77d77a5e 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -563,12 +563,12 @@ static struct pgpath *parse_path(struct arg_set *as, struct path_selector *ps, | |||
563 | /* we need at least a path arg */ | 563 | /* we need at least a path arg */ |
564 | if (as->argc < 1) { | 564 | if (as->argc < 1) { |
565 | ti->error = "no device given"; | 565 | ti->error = "no device given"; |
566 | return NULL; | 566 | return ERR_PTR(-EINVAL); |
567 | } | 567 | } |
568 | 568 | ||
569 | p = alloc_pgpath(); | 569 | p = alloc_pgpath(); |
570 | if (!p) | 570 | if (!p) |
571 | return NULL; | 571 | return ERR_PTR(-ENOMEM); |
572 | 572 | ||
573 | r = dm_get_device(ti, shift(as), ti->begin, ti->len, | 573 | r = dm_get_device(ti, shift(as), ti->begin, ti->len, |
574 | dm_table_get_mode(ti->table), &p->path.dev); | 574 | 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, | |||
596 | 596 | ||
597 | bad: | 597 | bad: |
598 | free_pgpath(p); | 598 | free_pgpath(p); |
599 | return NULL; | 599 | return ERR_PTR(r); |
600 | } | 600 | } |
601 | 601 | ||
602 | static struct priority_group *parse_priority_group(struct arg_set *as, | 602 | 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, | |||
614 | 614 | ||
615 | if (as->argc < 2) { | 615 | if (as->argc < 2) { |
616 | as->argc = 0; | 616 | as->argc = 0; |
617 | ti->error = "not enough priority group aruments"; | 617 | ti->error = "not enough priority group arguments"; |
618 | return NULL; | 618 | return ERR_PTR(-EINVAL); |
619 | } | 619 | } |
620 | 620 | ||
621 | pg = alloc_priority_group(); | 621 | pg = alloc_priority_group(); |
622 | if (!pg) { | 622 | if (!pg) { |
623 | ti->error = "couldn't allocate priority group"; | 623 | ti->error = "couldn't allocate priority group"; |
624 | return NULL; | 624 | return ERR_PTR(-ENOMEM); |
625 | } | 625 | } |
626 | pg->m = m; | 626 | pg->m = m; |
627 | 627 | ||
@@ -654,8 +654,10 @@ static struct priority_group *parse_priority_group(struct arg_set *as, | |||
654 | path_args.argv = as->argv; | 654 | path_args.argv = as->argv; |
655 | 655 | ||
656 | pgpath = parse_path(&path_args, &pg->ps, ti); | 656 | pgpath = parse_path(&path_args, &pg->ps, ti); |
657 | if (!pgpath) | 657 | if (IS_ERR(pgpath)) { |
658 | r = PTR_ERR(pgpath); | ||
658 | goto bad; | 659 | goto bad; |
660 | } | ||
659 | 661 | ||
660 | pgpath->pg = pg; | 662 | pgpath->pg = pg; |
661 | list_add_tail(&pgpath->list, &pg->pgpaths); | 663 | list_add_tail(&pgpath->list, &pg->pgpaths); |
@@ -666,7 +668,7 @@ static struct priority_group *parse_priority_group(struct arg_set *as, | |||
666 | 668 | ||
667 | bad: | 669 | bad: |
668 | free_priority_group(pg, ti); | 670 | free_priority_group(pg, ti); |
669 | return NULL; | 671 | return ERR_PTR(r); |
670 | } | 672 | } |
671 | 673 | ||
672 | static int parse_hw_handler(struct arg_set *as, struct multipath *m) | 674 | 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, | |||
785 | struct priority_group *pg; | 787 | struct priority_group *pg; |
786 | 788 | ||
787 | pg = parse_priority_group(&as, m); | 789 | pg = parse_priority_group(&as, m); |
788 | if (!pg) { | 790 | if (IS_ERR(pg)) { |
789 | r = -EINVAL; | 791 | r = PTR_ERR(pg); |
790 | goto bad; | 792 | goto bad; |
791 | } | 793 | } |
792 | 794 | ||