===================================================================
@@ -506,6 +506,8 @@ static void end_io_acct(struct mapped_de
bio->bi_iter.bi_sector, bio_sectors(bio),
true, duration, stats_aux);
+ smp_wmb();
+
bio_end_io_acct(bio, start_time);
/* nudge anyone waiting on suspend queue */
@@ -2170,9 +2172,8 @@ static int dm_wait_for_completion(struct
int r = 0;
if (!queue_is_mq(md->queue))
- return dm_wait_for_bios_completion(md, task_state);
-
- while (true) {
+ r = dm_wait_for_bios_completion(md, task_state);
+ else while (true) {
if (!blk_mq_queue_inflight(md->queue))
break;
@@ -2184,6 +2185,8 @@ static int dm_wait_for_completion(struct
msleep(5);
}
+ smp_rmb();
+
return r;
}
When one thread waits for another, we must use memory barriers, otherwise the CPU may reorder memory accesses. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org --- drivers/md/dm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel