aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-03-15 14:04:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-03-15 14:04:46 -0400
commit667058ae602c118d31d09f69ea52a4d193308128 (patch)
tree257a261192f42ad41219ae4594eb7f757a586315
parent0aa3fdb8b3a6df3c2e3b61dbfe079db9d30e03cd (diff)
parent8c5c147339d2e201108169327b1f99aa6d57d2cd (diff)
Merge tag 'for-4.16/dm-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mike Snitzer: - a stable DM multipath fix to restore ability to pass integrity data - two DM multipath fixes for a fix that was merged into 4.16-rc5 * tag 'for-4.16/dm-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm mpath: fix passing integrity data dm mpath: eliminate need to use scsi_device_from_queue dm mpath: fix uninitialized 'pg_init_wait' waitqueue_head NULL pointer
-rw-r--r--drivers/md/dm-mpath.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 3fde9e9faddd..a05a560d3cba 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>
@@ -223,6 +222,16 @@ static int alloc_multipath_stage2(struct dm_target *ti, struct multipath *m)
223 222
224 dm_table_set_type(ti->table, m->queue_mode); 223 dm_table_set_type(ti->table, m->queue_mode);
225 224
225 /*
226 * Init fields that are only used when a scsi_dh is attached
227 * - must do this unconditionally (really doesn't hurt non-SCSI uses)
228 */
229 set_bit(MPATHF_QUEUE_IO, &m->flags);
230 atomic_set(&m->pg_init_in_progress, 0);
231 atomic_set(&m->pg_init_count, 0);
232 m->pg_init_delay_msecs = DM_PG_INIT_DELAY_DEFAULT;
233 init_waitqueue_head(&m->pg_init_wait);
234
226 return 0; 235 return 0;
227} 236}
228 237
@@ -331,7 +340,6 @@ static void __switch_pg(struct multipath *m, struct priority_group *pg)
331 set_bit(MPATHF_PG_INIT_REQUIRED, &m->flags); 340 set_bit(MPATHF_PG_INIT_REQUIRED, &m->flags);
332 set_bit(MPATHF_QUEUE_IO, &m->flags); 341 set_bit(MPATHF_QUEUE_IO, &m->flags);
333 } else { 342 } else {
334 /* FIXME: not needed if no scsi_dh is attached */
335 clear_bit(MPATHF_PG_INIT_REQUIRED, &m->flags); 343 clear_bit(MPATHF_PG_INIT_REQUIRED, &m->flags);
336 clear_bit(MPATHF_QUEUE_IO, &m->flags); 344 clear_bit(MPATHF_QUEUE_IO, &m->flags);
337 } 345 }
@@ -796,15 +804,14 @@ static int parse_path_selector(struct dm_arg_set *as, struct priority_group *pg,
796 return 0; 804 return 0;
797} 805}
798 806
799static int setup_scsi_dh(struct block_device *bdev, struct multipath *m, char **error) 807static int setup_scsi_dh(struct block_device *bdev, struct multipath *m,
808 const char *attached_handler_name, char **error)
800{ 809{
801 struct request_queue *q = bdev_get_queue(bdev); 810 struct request_queue *q = bdev_get_queue(bdev);
802 const char *attached_handler_name;
803 int r; 811 int r;
804 812
805 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) { 813 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) {
806retain: 814retain:
807 attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL);
808 if (attached_handler_name) { 815 if (attached_handler_name) {
809 /* 816 /*
810 * Clear any hw_handler_params associated with a 817 * Clear any hw_handler_params associated with a
@@ -823,16 +830,6 @@ retain:
823 */ 830 */
824 kfree(m->hw_handler_name); 831 kfree(m->hw_handler_name);
825 m->hw_handler_name = attached_handler_name; 832 m->hw_handler_name = attached_handler_name;
826
827 /*
828 * Init fields that are only used when a scsi_dh is attached
829 */
830 if (!test_and_set_bit(MPATHF_QUEUE_IO, &m->flags)) {
831 atomic_set(&m->pg_init_in_progress, 0);
832 atomic_set(&m->pg_init_count, 0);
833 m->pg_init_delay_msecs = DM_PG_INIT_DELAY_DEFAULT;
834 init_waitqueue_head(&m->pg_init_wait);
835 }
836 } 833 }
837 } 834 }
838 835
@@ -868,7 +865,8 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps
868 int r; 865 int r;
869 struct pgpath *p; 866 struct pgpath *p;
870 struct multipath *m = ti->private; 867 struct multipath *m = ti->private;
871 struct scsi_device *sdev; 868 struct request_queue *q;
869 const char *attached_handler_name;
872 870
873 /* we need at least a path arg */ 871 /* we need at least a path arg */
874 if (as->argc < 1) { 872 if (as->argc < 1) {
@@ -887,11 +885,11 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps
887 goto bad; 885 goto bad;
888 } 886 }
889 887
890 sdev = scsi_device_from_queue(bdev_get_queue(p->path.dev->bdev)); 888 q = bdev_get_queue(p->path.dev->bdev);
891 if (sdev) { 889 attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL);
892 put_device(&sdev->sdev_gendev); 890 if (attached_handler_name) {
893 INIT_DELAYED_WORK(&p->activate_path, activate_path_work); 891 INIT_DELAYED_WORK(&p->activate_path, activate_path_work);
894 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);
895 if (r) { 893 if (r) {
896 dm_put_device(ti, p->path.dev); 894 dm_put_device(ti, p->path.dev);
897 goto bad; 895 goto bad;
@@ -2022,8 +2020,9 @@ static int multipath_busy(struct dm_target *ti)
2022 *---------------------------------------------------------------*/ 2020 *---------------------------------------------------------------*/
2023static struct target_type multipath_target = { 2021static struct target_type multipath_target = {
2024 .name = "multipath", 2022 .name = "multipath",
2025 .version = {1, 12, 0}, 2023 .version = {1, 13, 0},
2026 .features = DM_TARGET_SINGLETON | DM_TARGET_IMMUTABLE, 2024 .features = DM_TARGET_SINGLETON | DM_TARGET_IMMUTABLE |
2025 DM_TARGET_PASSES_INTEGRITY,
2027 .module = THIS_MODULE, 2026 .module = THIS_MODULE,
2028 .ctr = multipath_ctr, 2027 .ctr = multipath_ctr,
2029 .dtr = multipath_dtr, 2028 .dtr = multipath_dtr,