Mike Snitzer c322ee9320 dm mpath: fix racey management of PG initialization
Commit 935fcc56abc3 ("dm mpath: only flush workqueue when needed")
changed flush_multipath_work() to avoid needless workqueue
flushing (of a multipath global workqueue). But that change didn't
realize the surrounding flush_multipath_work() code should also only
run if 'pg_init_in_progress' is set.

Fix this by only doing all of flush_multipath_work()'s PG init related
work if 'pg_init_in_progress' is set.

Otherwise multipath_wait_for_pg_init_completion() will run
unconditionally but the preceeding flush_workqueue(kmpath_handlerd)
may not. This could lead to deadlock (though only if kmpath_handlerd
never runs a corresponding work to decrement 'pg_init_in_progress').

It could also be, though highly unlikely, that the kmpath_handlerd
work that does PG init completes before 'pg_init_in_progress' is set,
and then an intervening DM table reload's multipath_postsuspend()
triggers flush_multipath_work().

Fixes: 935fcc56abc3 ("dm mpath: only flush workqueue when needed")
Cc: stable@vger.kernel.org
Reported-by: Ben Marzinski <bmarzins@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2020-09-01 16:41:56 -04:00
..
2019-11-12 19:12:07 -07:00
2016-11-01 09:43:26 -06:00
2020-08-05 11:12:34 -07:00
2020-07-08 17:20:46 -06:00
2017-06-09 09:27:32 -06:00
2020-08-03 11:57:03 -07:00
2020-08-23 17:36:59 -05:00
2020-07-08 17:20:46 -06:00
2020-08-15 20:36:42 -07:00
2020-07-08 17:20:46 -06:00
2020-07-08 17:20:46 -06:00
2019-03-12 10:15:18 -07:00
2020-08-28 16:38:29 -07:00
2020-08-10 19:07:44 -07:00
2020-08-05 10:51:40 -07:00