block: ensure cached plug request matches the current queue

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: 47c122e35d ("block: pre-allocate requests if plug is started and is a batch")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe 2021-11-04 11:54:47 -06:00
parent 900e080752
commit 10c4787015
1 changed files with 1 additions and 1 deletions

View File

@ -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))