summaryrefslogtreecommitdiff
path: root/block/blk-mq.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 684acaa96db7..db2db0b70d34 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1222,6 +1222,15 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
spin_unlock(&hctx->lock);
/*
+ * Order adding requests to hctx->dispatch and checking
+ * SCHED_RESTART flag. The pair of this smp_mb() is the one
+ * in blk_mq_sched_restart(). Avoid restart code path to
+ * miss the new added requests to hctx->dispatch, meantime
+ * SCHED_RESTART is observed here.
+ */
+ smp_mb();
+
+ /*
* If SCHED_RESTART was set by the caller of this function and
* it is no longer set that means that it was cleared by another
* thread and hence that a queue rerun is needed.