Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a185eb4b authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe
Browse files

block: fix empty barrier on write-through w/ ordered tag



Empty barrier on write-through (or no cache) w/ ordered tag has no
command to execute and without any command to execute ordered tag is
never issued to the device and the ordering is never achieved.  Force
draining for such cases.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 58eea927
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -166,9 +166,21 @@ static inline bool start_ordered(struct request_queue *q, struct request **rqp)
	 * For an empty barrier, there's no actual BAR request, which
	 * For an empty barrier, there's no actual BAR request, which
	 * in turn makes POSTFLUSH unnecessary.  Mask them off.
	 * in turn makes POSTFLUSH unnecessary.  Mask them off.
	 */
	 */
	if (!rq->hard_nr_sectors)
	if (!rq->hard_nr_sectors) {
		q->ordered &= ~(QUEUE_ORDERED_DO_BAR |
		q->ordered &= ~(QUEUE_ORDERED_DO_BAR |
				QUEUE_ORDERED_DO_POSTFLUSH);
				QUEUE_ORDERED_DO_POSTFLUSH);
		/*
		 * Empty barrier on a write-through device w/ ordered
		 * tag has no command to issue and without any command
		 * to issue, ordering by tag can't be used.  Drain
		 * instead.
		 */
		if ((q->ordered & QUEUE_ORDERED_BY_TAG) &&
		    !(q->ordered & QUEUE_ORDERED_DO_PREFLUSH)) {
			q->ordered &= ~QUEUE_ORDERED_BY_TAG;
			q->ordered |= QUEUE_ORDERED_BY_DRAIN;
		}
	}


	/* stash away the original request */
	/* stash away the original request */
	elv_dequeue_request(q, rq);
	elv_dequeue_request(q, rq);