]> git.baikalelectronics.ru Git - kernel.git/commit
dm: add memory barrier before waitqueue_active
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 5 Feb 2019 10:09:00 +0000 (05:09 -0500)
committerMike Snitzer <snitzer@redhat.com>
Wed, 6 Feb 2019 22:24:37 +0000 (17:24 -0500)
commit43f71833078bdf9e43d15d6553d19e7fac3575c7
tree062ec799b850f8c0164b83a8538650dd17a448cf
parentb5cbce66baf0be0c7a7b3377a02035cf3ad62d9c
dm: add memory barrier before waitqueue_active

Block core changes to switch bio-based IO accounting to be percpu had a
side-effect of altering DM core to now rely on calling waitqueue_active
(in both bio-based and request-based) to check if another task is in
dm_wait_for_completion().

A memory barrier is needed before calling waitqueue_active().  DM core
doesn't piggyback on a preceding memory barrier so it must explicitly
use its own.

For more details on why using waitqueue_active() without a preceding
barrier is unsafe, please see the comment before the waitqueue_active()
definition in include/linux/wait.h.

Add the missing memory barrier by switching to using wq_has_sleeper().

Fixes: 4a151159a2b3 ("dm: remove the pending IO accounting")
Fixes: 073b253d74b2 ("dm: fix request-based dm's use of dm_wait_for_completion")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-rq.c
drivers/md/dm.c