summary refs log tree commit diff
path: root/drivers/md/dm-rq.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2019-02-05 05:09:00 -0500
committerMike Snitzer <snitzer@redhat.com>2019-02-06 17:24:37 -0500
commit645efa84f6c7566ea863ed37a8b3247247f72e02 (patch)
tree062ec799b850f8c0164b83a8538650dd17a448cf /drivers/md/dm-rq.c
parent8834f5600cf3c8db365e18a3d5cac2c2780c81e5 (diff)
downloadlinux-645efa84f6c7566ea863ed37a8b3247247f72e02.tar.gz
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: 6f75723190d8 ("dm: remove the pending IO accounting")
Fixes: c4576aed8d85 ("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>
Diffstat (limited to 'drivers/md/dm-rq.c')
-rw-r--r--drivers/md/dm-rq.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c
index 4eb5f8c56535..a20531e5f3b4 100644
--- a/drivers/md/dm-rq.c
+++ b/drivers/md/dm-rq.c
@@ -131,7 +131,7 @@ static void rq_end_stats(struct mapped_device *md, struct request *orig)
 static void rq_completed(struct mapped_device *md)
 {
 	/* nudge anyone waiting on suspend queue */
-	if (unlikely(waitqueue_active(&md->wait)))
+	if (unlikely(wq_has_sleeper(&md->wait)))
 		wake_up(&md->wait);
 
 	/*