dm-mpath.c (c74a7469f97c0f40b46e82ee979f9fb1bb6e847c) | dm-mpath.c (b592211c33f745af67a3271ce77c10fc1e6d6241) |
---|---|
1/* 2 * Copyright (C) 2003 Sistina Software Limited. 3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include <linux/device-mapper.h> --- 792 unchanged lines hidden (view full) --- 801 802 pg->ps.type = pst; 803 dm_consume_args(as, ps_argc); 804 805 return 0; 806} 807 808static int setup_scsi_dh(struct block_device *bdev, struct multipath *m, | 1/* 2 * Copyright (C) 2003 Sistina Software Limited. 3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include <linux/device-mapper.h> --- 792 unchanged lines hidden (view full) --- 801 802 pg->ps.type = pst; 803 dm_consume_args(as, ps_argc); 804 805 return 0; 806} 807 808static int setup_scsi_dh(struct block_device *bdev, struct multipath *m, |
809 const char *attached_handler_name, char **error) | 809 const char **attached_handler_name, char **error) |
810{ 811 struct request_queue *q = bdev_get_queue(bdev); 812 int r; 813 814 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) { 815retain: | 810{ 811 struct request_queue *q = bdev_get_queue(bdev); 812 int r; 813 814 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) { 815retain: |
816 if (attached_handler_name) { | 816 if (*attached_handler_name) { |
817 /* 818 * Clear any hw_handler_params associated with a 819 * handler that isn't already attached. 820 */ | 817 /* 818 * Clear any hw_handler_params associated with a 819 * handler that isn't already attached. 820 */ |
821 if (m->hw_handler_name && strcmp(attached_handler_name, m->hw_handler_name)) { | 821 if (m->hw_handler_name && strcmp(*attached_handler_name, m->hw_handler_name)) { |
822 kfree(m->hw_handler_params); 823 m->hw_handler_params = NULL; 824 } 825 826 /* 827 * Reset hw_handler_name to match the attached handler 828 * 829 * NB. This modifies the table line to show the actual 830 * handler instead of the original table passed in. 831 */ 832 kfree(m->hw_handler_name); | 822 kfree(m->hw_handler_params); 823 m->hw_handler_params = NULL; 824 } 825 826 /* 827 * Reset hw_handler_name to match the attached handler 828 * 829 * NB. This modifies the table line to show the actual 830 * handler instead of the original table passed in. 831 */ 832 kfree(m->hw_handler_name); |
833 m->hw_handler_name = attached_handler_name; | 833 m->hw_handler_name = *attached_handler_name; 834 *attached_handler_name = NULL; |
834 } 835 } 836 837 if (m->hw_handler_name) { 838 r = scsi_dh_attach(q, m->hw_handler_name); 839 if (r == -EBUSY) { 840 char b[BDEVNAME_SIZE]; 841 --- 20 unchanged lines hidden (view full) --- 862 863static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps, 864 struct dm_target *ti) 865{ 866 int r; 867 struct pgpath *p; 868 struct multipath *m = ti->private; 869 struct request_queue *q; | 835 } 836 } 837 838 if (m->hw_handler_name) { 839 r = scsi_dh_attach(q, m->hw_handler_name); 840 if (r == -EBUSY) { 841 char b[BDEVNAME_SIZE]; 842 --- 20 unchanged lines hidden (view full) --- 863 864static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps, 865 struct dm_target *ti) 866{ 867 int r; 868 struct pgpath *p; 869 struct multipath *m = ti->private; 870 struct request_queue *q; |
870 const char *attached_handler_name; | 871 const char *attached_handler_name = NULL; |
871 872 /* we need at least a path arg */ 873 if (as->argc < 1) { 874 ti->error = "no device given"; 875 return ERR_PTR(-EINVAL); 876 } 877 878 p = alloc_pgpath(); --- 6 unchanged lines hidden (view full) --- 885 ti->error = "error getting device"; 886 goto bad; 887 } 888 889 q = bdev_get_queue(p->path.dev->bdev); 890 attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL); 891 if (attached_handler_name || m->hw_handler_name) { 892 INIT_DELAYED_WORK(&p->activate_path, activate_path_work); | 872 873 /* we need at least a path arg */ 874 if (as->argc < 1) { 875 ti->error = "no device given"; 876 return ERR_PTR(-EINVAL); 877 } 878 879 p = alloc_pgpath(); --- 6 unchanged lines hidden (view full) --- 886 ti->error = "error getting device"; 887 goto bad; 888 } 889 890 q = bdev_get_queue(p->path.dev->bdev); 891 attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL); 892 if (attached_handler_name || m->hw_handler_name) { 893 INIT_DELAYED_WORK(&p->activate_path, activate_path_work); |
893 r = setup_scsi_dh(p->path.dev->bdev, m, attached_handler_name, &ti->error); | 894 r = setup_scsi_dh(p->path.dev->bdev, m, &attached_handler_name, &ti->error); |
894 if (r) { 895 dm_put_device(ti, p->path.dev); 896 goto bad; 897 } 898 } 899 900 r = ps->type->add_path(ps, &p->path, as->argc, as->argv, &ti->error); 901 if (r) { 902 dm_put_device(ti, p->path.dev); 903 goto bad; 904 } 905 906 return p; 907 bad: | 895 if (r) { 896 dm_put_device(ti, p->path.dev); 897 goto bad; 898 } 899 } 900 901 r = ps->type->add_path(ps, &p->path, as->argc, as->argv, &ti->error); 902 if (r) { 903 dm_put_device(ti, p->path.dev); 904 goto bad; 905 } 906 907 return p; 908 bad: |
909 kfree(attached_handler_name); |
|
908 free_pgpath(p); 909 return ERR_PTR(r); 910} 911 912static struct priority_group *parse_priority_group(struct dm_arg_set *as, 913 struct multipath *m) 914{ 915 static const struct dm_arg _args[] = { --- 1185 unchanged lines hidden --- | 910 free_pgpath(p); 911 return ERR_PTR(r); 912} 913 914static struct priority_group *parse_priority_group(struct dm_arg_set *as, 915 struct multipath *m) 916{ 917 static const struct dm_arg _args[] = { --- 1185 unchanged lines hidden --- |