aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-barrier.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index c63044e9c4c0..8eba4e43bb0c 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -166,9 +166,21 @@ static inline bool start_ordered(struct request_queue *q, struct request **rqp)
166 * For an empty barrier, there's no actual BAR request, which 166 * For an empty barrier, there's no actual BAR request, which
167 * in turn makes POSTFLUSH unnecessary. Mask them off. 167 * in turn makes POSTFLUSH unnecessary. Mask them off.
168 */ 168 */
169 if (!rq->hard_nr_sectors) 169 if (!rq->hard_nr_sectors) {
170 q->ordered &= ~(QUEUE_ORDERED_DO_BAR | 170 q->ordered &= ~(QUEUE_ORDERED_DO_BAR |
171 QUEUE_ORDERED_DO_POSTFLUSH); 171 QUEUE_ORDERED_DO_POSTFLUSH);
172 /*
173 * Empty barrier on a write-through device w/ ordered
174 * tag has no command to issue and without any command
175 * to issue, ordering by tag can't be used. Drain
176 * instead.
177 */
178 if ((q->ordered & QUEUE_ORDERED_BY_TAG) &&
179 !(q->ordered & QUEUE_ORDERED_DO_PREFLUSH)) {
180 q->ordered &= ~QUEUE_ORDERED_BY_TAG;
181 q->ordered |= QUEUE_ORDERED_BY_DRAIN;
182 }
183 }
172 184
173 /* stash away the original request */ 185 /* stash away the original request */
174 elv_dequeue_request(q, rq); 186 elv_dequeue_request(q, rq);