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

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

This patch fixes q->unplug_thresh condition check in


__elv_add_request().  rq.count[READ] + rq.count[WRITE] can increase
more than one if another thread has allocated a request after the
current request is allocated or in_flight could have changed resulting
in larger-than-one change of nrq, thus breaking the threshold
mechanism.

Signed-off-by: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
parent 9c56187d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -317,7 +317,7 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where,
			int nrq = q->rq.count[READ] + q->rq.count[WRITE]
				  - q->in_flight;

			if (nrq == q->unplug_thresh)
			if (nrq >= q->unplug_thresh)
				__generic_unplug_device(q);
		}
	} else