diff options
author | Mike Snitzer <snitzer@redhat.com> | 2018-03-12 19:49:25 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2018-03-13 15:09:56 -0400 |
commit | e8f74a0f00113d74ac18d6de13096f9e2f95618a (patch) | |
tree | bc9f364fa06510e223b94d1459526f111d5bec07 /drivers | |
parent | c37366742baa2bb3225be507d283baef151c5f8a (diff) |
dm mpath: eliminate need to use scsi_device_from_queue
Instead of scsi_device_from_queue(), use scsi_dh_attached_handler_name()
-- whose implementation uses scsi_device_from_queue() to avoid trying to
access SCSI-specific resources from non-SCSI devices.
Fixes buildbot reported issue when CONFIG_SCSI isn't set:
ERROR: "scsi_device_from_queue" [drivers/md/dm-multipath.ko] undefined!
Fixes: 8d47e65948dd ("dm mpath: remove unnecessary NVMe branching in favor of scsi_dh checks")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-mpath.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 87c404eebe9f..2481c4794ed6 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/time.h> | 22 | #include <linux/time.h> |
23 | #include <linux/workqueue.h> | 23 | #include <linux/workqueue.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <scsi/scsi_device.h> | ||
26 | #include <scsi/scsi_dh.h> | 25 | #include <scsi/scsi_dh.h> |
27 | #include <linux/atomic.h> | 26 | #include <linux/atomic.h> |
28 | #include <linux/blk-mq.h> | 27 | #include <linux/blk-mq.h> |
@@ -805,15 +804,14 @@ static int parse_path_selector(struct dm_arg_set *as, struct priority_group *pg, | |||
805 | return 0; | 804 | return 0; |
806 | } | 805 | } |
807 | 806 | ||
808 | static int setup_scsi_dh(struct block_device *bdev, struct multipath *m, char **error) | 807 | static int setup_scsi_dh(struct block_device *bdev, struct multipath *m, |
808 | const char *attached_handler_name, char **error) | ||
809 | { | 809 | { |
810 | struct request_queue *q = bdev_get_queue(bdev); | 810 | struct request_queue *q = bdev_get_queue(bdev); |
811 | const char *attached_handler_name; | ||
812 | int r; | 811 | int r; |
813 | 812 | ||
814 | if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) { | 813 | if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) { |
815 | retain: | 814 | retain: |
816 | attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL); | ||
817 | if (attached_handler_name) { | 815 | if (attached_handler_name) { |
818 | /* | 816 | /* |
819 | * Clear any hw_handler_params associated with a | 817 | * Clear any hw_handler_params associated with a |
@@ -867,7 +865,8 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps | |||
867 | int r; | 865 | int r; |
868 | struct pgpath *p; | 866 | struct pgpath *p; |
869 | struct multipath *m = ti->private; | 867 | struct multipath *m = ti->private; |
870 | struct scsi_device *sdev; | 868 | struct request_queue *q; |
869 | const char *attached_handler_name; | ||
871 | 870 | ||
872 | /* we need at least a path arg */ | 871 | /* we need at least a path arg */ |
873 | if (as->argc < 1) { | 872 | if (as->argc < 1) { |
@@ -886,11 +885,11 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps | |||
886 | goto bad; | 885 | goto bad; |
887 | } | 886 | } |
888 | 887 | ||
889 | sdev = scsi_device_from_queue(bdev_get_queue(p->path.dev->bdev)); | 888 | q = bdev_get_queue(p->path.dev->bdev); |
890 | if (sdev) { | 889 | attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL); |
891 | put_device(&sdev->sdev_gendev); | 890 | if (attached_handler_name) { |
892 | INIT_DELAYED_WORK(&p->activate_path, activate_path_work); | 891 | INIT_DELAYED_WORK(&p->activate_path, activate_path_work); |
893 | r = setup_scsi_dh(p->path.dev->bdev, m, &ti->error); | 892 | r = setup_scsi_dh(p->path.dev->bdev, m, attached_handler_name, &ti->error); |
894 | if (r) { | 893 | if (r) { |
895 | dm_put_device(ti, p->path.dev); | 894 | dm_put_device(ti, p->path.dev); |
896 | goto bad; | 895 | goto bad; |