Skip to content

Commit

Permalink
block: ensure cached plug request matches the current queue
Browse files Browse the repository at this point in the history
If we're driving multiple devices, we could have pre-populated the cache
for a different device. Ensure that the empty request matches the current
queue.

Fixes: 47c122e ("block: pre-allocate requests if plug is started and is a batch")
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Nov 5, 2021
1 parent 900e080 commit 10c4787
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2540,7 +2540,7 @@ static inline struct request *blk_mq_get_request(struct request_queue *q,
struct request *rq;

rq = rq_list_peek(&plug->cached_rq);
if (rq) {
if (rq && rq->q == q) {
if (unlikely(!submit_bio_checks(bio)))
return NULL;
if (blk_attempt_bio_merge(q, bio, nsegs, same_queue_rq))
Expand Down

0 comments on commit 10c4787

Please sign in to comment.