Skip to content

Commit 10c4787

Browse files
committed
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: 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]>
1 parent 900e080 commit 10c4787

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/blk-mq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2540,7 +2540,7 @@ static inline struct request *blk_mq_get_request(struct request_queue *q,
25402540
struct request *rq;
25412541

25422542
rq = rq_list_peek(&plug->cached_rq);
2543-
if (rq) {
2543+
if (rq && rq->q == q) {
25442544
if (unlikely(!submit_bio_checks(bio)))
25452545
return NULL;
25462546
if (blk_attempt_bio_merge(q, bio, nsegs, same_queue_rq))

0 commit comments

Comments
 (0)