Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dm mpath: changes from initial m->flags locking audit

Fix locking in slow-paths where m->lock should be taken.

Signed-off-by: Mike Snitzer <snitzer@rredhat.com>

+13 -3
+13 -3
drivers/md/dm-mpath.c
··· 335 335 336 336 static void __switch_pg(struct multipath *m, struct priority_group *pg) 337 337 { 338 + lockdep_assert_held(&m->lock); 339 + 338 340 m->current_pg = pg; 339 341 340 342 /* Must we initialise the PG first, and queue I/O till it's ready? */ ··· 384 382 unsigned bypassed = 1; 385 383 386 384 if (!atomic_read(&m->nr_valid_paths)) { 385 + spin_lock_irqsave(&m->lock, flags); 387 386 clear_bit(MPATHF_QUEUE_IO, &m->flags); 387 + spin_unlock_irqrestore(&m->lock, flags); 388 388 goto failed; 389 389 } 390 390 ··· 426 422 continue; 427 423 pgpath = choose_path_in_pg(m, pg, nr_bytes); 428 424 if (!IS_ERR_OR_NULL(pgpath)) { 429 - if (!bypassed) 425 + if (!bypassed) { 426 + spin_lock_irqsave(&m->lock, flags); 430 427 set_bit(MPATHF_PG_INIT_DELAY_RETRY, &m->flags); 428 + spin_unlock_irqrestore(&m->lock, flags); 429 + } 431 430 return pgpath; 432 431 } 433 432 } ··· 1669 1662 1670 1663 spin_lock_irqsave(&m->lock, flags); 1671 1664 bio_list_add(&m->queued_bios, clone); 1672 - spin_unlock_irqrestore(&m->lock, flags); 1673 1665 if (!test_bit(MPATHF_QUEUE_IO, &m->flags)) 1674 1666 queue_work(kmultipathd, &m->process_queued_bios); 1667 + spin_unlock_irqrestore(&m->lock, flags); 1675 1668 1676 1669 r = DM_ENDIO_INCOMPLETE; 1677 1670 done: ··· 1945 1938 { 1946 1939 struct multipath *m = ti->private; 1947 1940 struct pgpath *current_pgpath; 1941 + unsigned long flags; 1948 1942 int r; 1949 1943 1950 1944 current_pgpath = READ_ONCE(m->current_pgpath); ··· 1973 1965 /* Path status changed, redo selection */ 1974 1966 (void) choose_pgpath(m, 0); 1975 1967 } 1968 + spin_lock_irqsave(&m->lock, flags); 1976 1969 if (test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) 1977 - pg_init_all_paths(m); 1970 + (void) __pg_init_all_paths(m); 1971 + spin_unlock_irqrestore(&m->lock, flags); 1978 1972 dm_table_run_md_queue_async(m->ti->table); 1979 1973 process_queued_io_list(m); 1980 1974 }