blk-mq: don't plug for synchronously polled requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For synchronous polling to work, the bio must be issued to the driver from
the submit_bio call, otherwise ->bi_cookie won't be set.

Based on a patch from Ming Lei.

Reported-by: Changhui Zhong <czhong@xxxxxxxxxx>
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 block/blk-mq.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index ed3ed86f7dd24..bcc7e3d11296c 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2851,7 +2851,13 @@ void blk_mq_submit_bio(struct bio *bio)
 		return;
 	}
 
-	if (plug)
+	/*
+	 * We can't plug for synchronously polled submissions, otherwise
+	 * bio->bi_cookie won't be set directly after submission, which is the
+	 * indicator used by the submitter to check if a bio needs polling.
+	 */
+	if (plug &&
+	    (rq->bio->bi_opf & (REQ_POLLED | REQ_NOWAIT)) != REQ_POLLED)
 		blk_add_rq_to_plug(plug, rq);
 	else if ((rq->rq_flags & RQF_ELV) ||
 		 (rq->mq_hctx->dispatch_busy &&
-- 
2.30.2




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux