diff mbox series

[5/5] block: ensure cached plug request matches the current queue

Message ID 20211104152204.57360-6-axboe@kernel.dk (mailing list archive)
State New, archived
Headers show
Series Alloc batch fixes | expand

Commit Message

Jens Axboe Nov. 4, 2021, 3:22 p.m. UTC
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: 47c122e35d7e ("block: pre-allocate requests if plug is started and is a batch")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c
index b0c0eac43eef..e9397bcdd90c 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2487,7 +2487,7 @@  static inline struct request *blk_get_plug_request(struct request_queue *q,
 	if (!plug)
 		return NULL;
 	rq = rq_list_peek(&plug->cached_rq);
-	if (!rq)
+	if (!rq || rq->q != q)
 		return NULL;
 	if (unlikely(!submit_bio_checks(bio)))
 		return ERR_PTR(-EIO);