]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
dm mpath: fix racey management of PG initialization
authorMike Snitzer <snitzer@redhat.com>
Mon, 24 Aug 2020 18:19:55 +0000 (14:19 -0400)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Thu, 17 Sep 2020 06:47:08 +0000 (00:47 -0600)
commitb15fcedfa5d741da4435373c6e594dab6f54955c
treea6d810d1023938bea3657fa6d365544b7655a045
parent2ca7f00847c20026d2c1b3452db02d918cbf974f
dm mpath: fix racey management of PG initialization

BugLink: https://bugs.launchpad.net/bugs/1895880
commit c322ee9320eaa4013ca3620b1130992916b19b31 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: William Breathitt Gray <william.gray@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/md/dm-mpath.c